Page MenuHomePhabricator

[services][backup] SendLog 3/4 - handle log data
ClosedPublic

Authored by bartek on Jan 10 2023, 8:40 AM.
Tags
None
Referenced Files
F3491701: D6213.diff
Wed, Dec 18, 7:59 PM
Unknown Object (File)
Thu, Nov 28, 4:21 AM
Unknown Object (File)
Thu, Nov 28, 4:21 AM
Unknown Object (File)
Thu, Nov 28, 4:21 AM
Unknown Object (File)
Thu, Nov 28, 4:21 AM
Unknown Object (File)
Thu, Nov 28, 4:21 AM
Unknown Object (File)
Nov 8 2024, 5:34 PM
Unknown Object (File)
Nov 8 2024, 1:59 PM
Subscribers

Details

Summary

This diff implements receiving log contents data. By default, log data is going to be directly saved in database.
Each received data chunk is appended to the buffer. If the log item becomes too large to be stored in DynamoDB,
then log contents is moved to Blob service storage and further chunks are uploaded there directly.

Depends on D6212

Test Plan

The service builds and starts. Logic of this diff can be tested altogether with the child diff - see the description there.

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.Jan 11 2023, 1:31 PM
bartek added a reviewer: michal.
tomek added inline comments.
services/backup/src/service/handlers/send_log.rs
127–133 ↗(On Diff #20754)

This doesn't seem to be properly formatted (the curly bracket)

134–158 ↗(On Diff #20754)

Can we make this symmetric by introducing move_to_blob function?

141 ↗(On Diff #20754)

Why do we have to provide holder twice?

bartek added inline comments.
services/backup/src/service/handlers/send_log.rs
127–133 ↗(On Diff #20754)

cargo fmt must be wrong ;) It forces the { to be in new line

134–158 ↗(On Diff #20754)

Sure, will do

141 ↗(On Diff #20754)

my bad - I misread the ugly C++ code, it should be log_hash

  • Worked around curly bracket formatting ;)
  • Fixed incorrect hash provided to put client
  • Extracted the ensure_size_constraints() function which both checks logs size and moves to blob if it's too big. At first I tried extracting only move_to_blob() but this required either code duplication (params unpacking) or violated borrow checker rules, eventually nasty cloning.
This revision is now accepted and ready to land.Jan 19 2023, 8:25 AM
  • Rebase
  • Set persistence to blob regardless of blob client being created. Otherwise, when hash already exists, persistence could be switched back to DB and cause trouble because it's already too large.