Page MenuHomePhabricator

[backup] Namespace log id in db
ClosedPublic

Authored by michal on Jan 29 2024, 2:31 AM.
Tags
None
Referenced Files
F3500926: D10857.diff
Fri, Dec 20, 3:14 AM
Unknown Object (File)
Mon, Dec 16, 2:37 PM
Unknown Object (File)
Mon, Dec 16, 2:37 PM
Unknown Object (File)
Mon, Dec 16, 2:37 PM
Unknown Object (File)
Mon, Dec 16, 2:37 PM
Unknown Object (File)
Fri, Dec 6, 8:31 AM
Unknown Object (File)
Fri, Nov 29, 1:11 AM
Unknown Object (File)
Thu, Nov 28, 9:03 PM
Subscribers

Details

Summary

This was an idea that I wanted to implement but forgot before. We can prefix the backupID partitioning key in the log table with the userID. I think this is better because it allows us to map the log directly to the backup in the backup table (before we didn't knew the userID which is the partitioning key of the backup table). This is a quick change and we still aren't using backup service in production so I decided to implement it now. An alternative would be to add a new attribute but I prefer to keep them both in the partitioning key as they really represent a one things -> a specific backup of a given user. And if we ever need to iterate over specific user's logs we will also need to iterate over the compaction data so it wouldn't gain us anything.

Test Plan

Run backup integration tests.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

bartek added inline comments.
services/backup/src/database/log_item.rs
108โ€“119 โ†—(On Diff #36239)

If you're taking (moving) the id here, are these ref/slice gymnastics still necessary? ๐Ÿ˜‰

This revision is now accepted and ready to land.Jan 29 2024, 7:58 AM
services/backup/src/database/log_item.rs
108โ€“119 โ†—(On Diff #36239)

split returns an iterator over &str and I don't think there is a mutable version of it, so I don't think we can get rid of the to_string calls.

The &[..] is just so we can pattern match on the result. We could do it more "imperatively" but I like this approach because we directly specify that we want an array with two values.

Alternatively we could use as_slice instead of &[..].