Page MenuHomePhabricator

[backup] Namespace log id in db
ClosedPublic

Authored by michal on Jan 29 2024, 2:31 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Nov 13, 4:55 AM
Unknown Object (File)
Wed, Nov 13, 4:55 AM
Unknown Object (File)
Wed, Nov 13, 4:55 AM
Unknown Object (File)
Wed, Nov 13, 4:55 AM
Unknown Object (File)
Wed, Nov 13, 4:07 AM
Unknown Object (File)
Tue, Nov 12, 6:57 AM
Unknown Object (File)
Mon, Nov 4, 7:49 AM
Unknown Object (File)
Fri, Nov 1, 9:41 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 &[..].