Page MenuHomePhabricator

[services] Backup - Blob Get Client - Refactor put initialize
ClosedPublic

Authored by karol on Sep 9 2022, 4:44 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Dec 20, 12:53 AM
Unknown Object (File)
Fri, Dec 20, 12:53 AM
Unknown Object (File)
Thu, Dec 19, 2:01 AM
Unknown Object (File)
Tue, Dec 17, 11:47 PM
Unknown Object (File)
Tue, Dec 17, 11:47 PM
Unknown Object (File)
Mon, Dec 16, 4:09 AM
Unknown Object (File)
Mon, Dec 16, 4:09 AM
Unknown Object (File)
Mon, Dec 16, 4:09 AM

Details

Summary

Depends on D5095

Linear task: https://linear.app/comm/issue/ENG-1734/improve-error-handling-system-in-the-blob-client

Using a new way of error handling in the initialize method of the put client.

Test Plan
cd services/backup/blob_client
cargo check

after running localstack, blob and backup (in this particular order), this still works:

yarn run-performance-tests backup

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

jon requested changes to this revision.Sep 9 2022, 10:47 AM
jon added inline comments.
services/backup/blob_client/src/put_client.rs
48 ↗(On Diff #16548)

functions or values named is_XXX I feel should always return a bool. Returning a result seems very odd

48–54 ↗(On Diff #16548)

Feel like the logic should be:

106 ↗(On Diff #16548)

really don't like the use of panic, as this will probably cause issues going across the C++ interface. But I think this gets handled in another diff.

But ideally, we wouldn't have an intermediate "worst case"

This revision now requires changes to proceed.Sep 9 2022, 10:47 AM
services/backup/blob_client/src/put_client.rs
48 ↗(On Diff #16548)

It essentially returns bool though. The "error" part of the result stands for... well, error. I don't really understand what is the problem here. The "result" syntax is just an equivalent of throw in c++ let's say.

48–54 ↗(On Diff #16548)

I don't think this is a good idea, sorry. The problem with what you proposed is that it's going to return false when we fail to lock. Failed locking should be considered an exceptional situation and handled differently than not having a client initialized.

Now, with your proposal, if this function returned false, we'd not know whether it failed to access the clients or if there's no such client in the collection.

106 ↗(On Diff #16548)

Yes, you're talking about D5097. We can do this earlier (I mean here).

This revision is now accepted and ready to land.Sep 12 2022, 9:07 AM
tomek added inline comments.
services/backup/blob_client/src/put_client.rs
48 ↗(On Diff #16688)
49–54 ↗(On Diff #16688)

This is a strange pattern - it would be more readable to see this match outside. Something like the suggested code, but the case for _ may be slightly different.

64–66 ↗(On Diff #16688)

ensure

115 ↗(On Diff #16688)

Do we have a task / plan how we will improve this?

128 ↗(On Diff #16688)

Is there a better way to handle Result than using match? Maybe anyhow can be used for that?

162 ↗(On Diff #16688)

ensure

services/backup/blob_client/src/put_client.rs
115 ↗(On Diff #16688)

Please create task before landing and link here

services/backup/blob_client/src/put_client.rs
115 ↗(On Diff #16688)
128 ↗(On Diff #16688)

I just used ? in D5097

This revision was landed with ongoing or failed builds.Sep 19 2022, 7:28 AM
This revision was automatically updated to reflect the committed changes.