Page MenuHomePhabricator

[services] Backup - Add DB operations for Logs
ClosedPublic

Authored by karol on Feb 11 2022, 3:40 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Apr 27, 8:47 AM
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
Unknown Object (File)
Sat, Apr 6, 4:11 AM
Unknown Object (File)
Thu, Apr 4, 10:23 PM
Unknown Object (File)
Thu, Apr 4, 10:23 PM

Details

Summary

Database operations for LogItems

Depends on D3161

Test Plan

Backup service still builds

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, 4:00 AM
tomek added inline comments.
services/backup/docker-server/contents/server/src/DatabaseManager.cpp
144 ↗(On Diff #9560)

We're not fetching here by primary key but by partition key... but in fact it doesn't matter, as we're interested in all the logs that are associated with a given backup, so we should explicitly use backup column name here.

This revision now requires changes to proceed.Feb 11 2022, 4:00 AM
karol added inline comments.
services/backup/docker-server/contents/server/src/DatabaseManager.cpp
144 ↗(On Diff #9560)

This is fixed in https://phabricator.ashoat.com/D3177

In order to make it work properly, I had to refactor more files/places so I decided to make it right in another diff.

This revision is now accepted and ready to land.Feb 11 2022, 7:23 AM
This revision now requires review to proceed.Feb 11 2022, 7:23 AM
ashoat requested changes to this revision.Feb 13 2022, 8:47 PM

I don't feel comfortable accepting this given the concerns laid out in D3160, and the fact that the primary key issue is only addressed in D3177, but in a way that leads to the aforementioned concerns specified in D3160

services/backup/docker-server/contents/server/src/DatabaseManager.cpp
144 ↗(On Diff #9560)

I realize it is easier for you as a diff author to add a new diff with fixes instead of updating your original diffs, but it's hard for your reviewers this way. Keep in mind that this approach has mental cost for each individual reviewer who has to read your code.

  1. Whenever possible, it's better to avoid forcing somebody to have to read a later diff in order to understand an earlier diff.
  2. If you can't do that for some reason, then you should at least preemptively leave a comment to save your reviewer time.
This revision now requires changes to proceed.Feb 13 2022, 8:47 PM

Back to your queue as I responded in D3160 and there were no doubts about the code here.

services/backup/docker-server/contents/server/src/DatabaseManager.cpp
144 ↗(On Diff #9560)

I wasn't looking at what's easier for me to be honest. My goal was to make my changes as clean as possible.

The error with the primary key has been in services for some time now. It's basically a logic/terminology error because a primary key consists of a partition key and a sort key. Until D3177 and D3179, I treated partition keys as primary keys. It appeared now as we used primary keys that also include sort keys for the first time.

The current revision adds database operations for logs after I did the same for backup items. I try to keep changes I introduce as separated as possible - isn't it the main goal of diffs flow?

I didn't want to mix introducing database operations for separate items with fixing the logic error that exists in all services.

  1. Whenever possible, it's better to avoid forcing somebody to have to read a later diff in order to understand an earlier diff.

You don't have to read any later diff to understand this one I think(maybe I'm wrong). Tomek just pointed out my mistake which is going to be fixed in later diffs but the code in this revision is consistent with the rest of the codebase at this point in the timeline.

  1. If you can't do that for some reason, then you should at least preemptively leave a comment to save your reviewer time.

Didn't feel like it was needed as this code stands for itself I believe.

Maybe I'm missing something but if I had to do these changes again, I'd use the same order. I still think it's pretty logical and has no "future connections".

I think the best thing to do would've been to put the sort key diffs as early in the stack as possible. Think of it this way: if the sort key diffs are earlier, then we never see any code using the "old way" for primary keys, so your reviewer never has to get confused or ask a question. Whereas if you put the sort key diff later in the stack, then there are some diffs still using the "old way", which is confusing to see as a reviewer.

Basically, my point is that once you realized that the sort key needed you change, you should've interactive-rebased to the front of your stack and put the new diff there, and then rebased all of the rest of your diffs on the change. It's more work but it's easier to review.

Anyways, the underlying concerns in D3160 have been addressing so unblocking here! We can follow up about the sort key in D3177/D3179.

This revision is now accepted and ready to land.Feb 14 2022, 8:21 PM