Page MenuHomePhabricator

[services] Backup - Reuse remove logic
ClosedPublic

Authored by karol on Feb 11 2022, 3:42 AM.
Tags
None
Referenced Files
F1773251: D3178.diff
Wed, May 15, 10:47 PM
Unknown Object (File)
Tue, Apr 23, 5:30 PM
Unknown Object (File)
Tue, Apr 23, 5:30 PM
Unknown Object (File)
Tue, Apr 23, 5:30 PM
Unknown Object (File)
Tue, Apr 23, 5:30 PM
Unknown Object (File)
Tue, Apr 23, 5:30 PM
Unknown Object (File)
Tue, Apr 23, 5:30 PM
Unknown Object (File)
Tue, Apr 23, 5:24 PM

Details

Summary

Reuse innerRemoveItem for BackupItem`s and LogItems

Depends on D3177

Test Plan
cd services
yarn test-backup-service

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

karol edited the test plan for this revision. (Show Details)
karol added reviewers: tomek, max, varun.
tomek requested changes to this revision.Feb 11 2022, 7:54 AM
tomek added inline comments.
services/backup/docker-server/contents/server/src/DatabaseManager.cpp
33–36 ↗(On Diff #9563)

This is really confusing. On one hand, we use PrimaryKey to describe db structure by having column names in it. And now, we use the same object to store primary key value.
Additionally, primaryKeyValue is created by taking some fields from item and we pass both of them to this function - it doesn't make too much sense.

We should instead add a method to Item e.g. getPrimaryKeyValue and use this method here. And I think we should have separate types for PrimaryKey and PrimaryKeyValue just to avoid them being confused with each other.

This revision now requires changes to proceed.Feb 11 2022, 7:54 AM
services/backup/docker-server/contents/server/src/DatabaseManager.cpp
33–36 ↗(On Diff #9563)

When I was writing this code I realized this can be confusing. Didn't really have an idea on how to overcome this.

We can do getPrimaryKeyValue and also "separate" these types: PrimaryKey and PrimaryKeyValue. My idea is that they can be the same but have different names just to make it more clear.

changes requested in the review

tomek requested changes to this revision.Feb 14 2022, 6:22 AM
tomek added inline comments.
services/backup/docker-server/contents/server/src/DatabaseManager.cpp
31–37 ↗(On Diff #9604)

Can't we just take primaryKeyValue from the item?

This revision now requires changes to proceed.Feb 14 2022, 6:22 AM
services/backup/docker-server/contents/server/src/DatabaseManager.cpp
31–37 ↗(On Diff #9604)

Yes! Thanks!

This revision is now accepted and ready to land.Feb 15 2022, 7:22 AM
This revision now requires review to proceed.Feb 15 2022, 7:22 AM
This revision is now accepted and ready to land.Feb 15 2022, 7:57 PM
This revision was automatically updated to reflect the committed changes.