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
F3503969: D6213.id20754.diff
Fri, Dec 20, 6:57 AM
F3502556: D6213.id21108.diff
Fri, Dec 20, 4:24 AM
F3502555: D6213.id21092.diff
Fri, Dec 20, 4:24 AM
F3502554: D6213.id20893.diff
Fri, Dec 20, 4:24 AM
F3502553: D6213.id20754.diff
Fri, Dec 20, 4:24 AM
F3502515: D6213.id.diff
Fri, Dec 20, 4:24 AM
F3502480: D6213.diff
Fri, Dec 20, 4:17 AM
Unknown Object (File)
Wed, Dec 18, 11:06 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
Lint Not Applicable
Unit
Tests Not Applicable

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.