Page MenuHomePhabricator

[services] Tunnelbroker - Switching to use composite key in a messages table in Terraform
ClosedPublic

Authored by max on Jul 7 2022, 6:37 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Nov 2, 2:21 PM
Unknown Object (File)
Sat, Nov 2, 2:21 PM
Unknown Object (File)
Sat, Nov 2, 2:21 PM
Unknown Object (File)
Sat, Nov 2, 2:17 PM
Unknown Object (File)
Mon, Oct 7, 4:47 AM
Unknown Object (File)
Mon, Oct 7, 4:47 AM
Unknown Object (File)
Mon, Oct 7, 4:47 AM
Unknown Object (File)
Oct 4 2024, 9:18 PM

Details

Summary

To avoid possible message UUID collision and speedup batch messages deletion we should switch to using the composite key for the tunnelbroker-messages table which will consist of messagesID as a Sort Key and toDeviceID as a Partition key.

This diff is a part of the stack and introduces changes for Terraform.

Linear task: ENG-1362

Test Plan

These changes should be tested at the D4475 diff. The current messageItem related tests at services/tunnelbroker/test/DatabaseManagerTest.cpp should not fail including:

  • PutAndFoundMessageItemsStaticDataIsSame
  • PutAndFoundMessageItemsGeneratedDataIsSame
  • PutAndFoundByReceiverMessageItemsDataIsSame

Diff Detail

Repository
rCOMM Comm
Branch
switch-to-composite-messages-key
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

max held this revision as a draft.
max retitled this revision from [services] Tunnelbroker - Switching to use composite key in a messages table inTerraform to [services] Tunnelbroker - Switching to use composite key in a messages table in Terraform.Jul 7 2022, 6:48 AM
max added reviewers: karol, tomek.
max published this revision for review.Jul 7 2022, 7:06 AM
tomek added 1 blocking reviewer(s): karol.

Shouldn't we also modify the entity files? I'd put the fields in this file (especially in the constructor) in the correct order which would be:

  • partition key
  • sort key
  • the rest of the fields

So, for the messages this would be:

  • toDeviceID
  • messageID
  • fromDeviceID
  • payload
  • ...

What do you think? Sorry for requesting changes but I wanted to push it to your queue.

This revision now requires changes to proceed.Jul 11 2022, 3:07 AM
In D4473#127995, @karol-bisztyga wrote:

Shouldn't we also modify the entity files? I'd put the fields in this file (especially in the constructor) in the correct order which would be:

  • partition key
  • sort key
  • the rest of the fields

So, for the messages this would be:

  • toDeviceID
  • messageID
  • fromDeviceID
  • payload
  • ...

What do you think? Sorry for requesting changes but I wanted to push it to your queue.

I think this is a good idea. I created a follow-up for this as ENG-1384.

This revision is now accepted and ready to land.Jul 19 2022, 2:17 AM