Page MenuHomePhabricator

[services] Backup - Reuse remove logic
ClosedPublic

Authored by karol on Feb 11 2022, 3:42 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Nov 30, 9:09 AM
Unknown Object (File)
Thu, Nov 28, 11:29 AM
Unknown Object (File)
Wed, Nov 27, 8:54 AM
Unknown Object (File)
Wed, Nov 27, 8:06 AM
Unknown Object (File)
Sat, Nov 23, 2:48 PM
Unknown Object (File)
Thu, Nov 14, 4:00 PM
Unknown Object (File)
Fri, Nov 8, 6:58 PM
Unknown Object (File)
Tue, Nov 5, 6:42 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
No Lint Coverage
Unit
No Test Coverage

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

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

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.