Page MenuHomePhabricator

[services] Backup/Blob - Add terminateCallback
ClosedPublic

Authored by karol on Mar 30 2022, 5:03 AM.
Tags
None
Referenced Files
F3115362: D3560.id10811.diff
Thu, Oct 31, 9:27 PM
Unknown Object (File)
Sun, Oct 13, 4:36 PM
Unknown Object (File)
Sun, Oct 13, 4:36 PM
Unknown Object (File)
Sun, Oct 13, 4:35 PM
Unknown Object (File)
Sun, Oct 13, 4:32 PM
Unknown Object (File)
Sep 24 2024, 9:49 AM
Unknown Object (File)
Sep 15 2024, 4:55 AM
Unknown Object (File)
Sep 15 2024, 4:55 AM

Details

Summary

Depends on D3559

We want to add an additional callback that will be executed before the connection ends but after we are done with the communication.

From now on we will have two "ending" callbacks:

  • doneCallback - this is executed after the connection ends and there will be no more grpc operations in the current context
  • terminateCallback - this is executed when we're done with the communication but we have not yet closed the connection

The reason to introduce the termination callback is that I needed to wait until the backup client work is done before I closed the connection from backup with the client. Having this, we are able to tell when the whole backup operation is done, without it we only knew when the communication between the client and the backup was done(plus the chunks were sent to the blob but we wouldn't know what happened to them after that).

Test Plan
cd services
yarn run-backup-service

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

tomek added inline comments.
services/blob/src/Reactors/server/base-reactors/ServerWriteReactorBase.h
91 ↗(On Diff #10811)

What changed in this diff which made it possible to avoid try-catch here?

This revision is now accepted and ready to land.Apr 1 2022, 4:54 AM

In theory, one of these could be a destructor, but having a callback is probably more maintainable

services/blob/src/Reactors/server/base-reactors/ServerWriteReactorBase.h
91 ↗(On Diff #10811)

It was redundant because the entire block of NextWrite is wrapped in try ... catch