Page MenuHomePhabricator

[services] Tunnelbroker - DatabaseManager method to find messages by the receiver
ClosedPublic

Authored by max on Feb 16 2022, 4:53 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Nov 3, 3:20 PM
Unknown Object (File)
Sun, Nov 3, 3:20 PM
Unknown Object (File)
Sun, Nov 3, 3:20 PM
Unknown Object (File)
Sun, Nov 3, 3:20 PM
Unknown Object (File)
Sun, Nov 3, 3:20 PM
Unknown Object (File)
Sun, Nov 3, 3:18 PM
Unknown Object (File)
Oct 8 2024, 1:04 AM
Unknown Object (File)
Sep 23 2024, 1:07 PM

Details

Summary

We need to fetch undelivered messages from the database by the receiver which is toDeviceID field in our case.
findMessageItemsByReceiever method was implemented for this purpose.

Related linear task: ENG-751

Architecture review for the tunnelbroker.

Test Plan

Unit tests are on D3781

Diff Detail

Repository
rCOMM Comm
Branch
find-message-by-receiver
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

Hey @geekbrother is there anything like a DB structure schema described somewhere for the tunnelbroker? I bet you understand it, but it would be cool to have it in one place for other people. You can look at D2950 something like this would be great... It would be really helpful to review diffs like this and in general to understand how the service works. For now, if I want to figure this out, I have to:

  • go through the dynamo DB console on AWS - to see what's the primary keys(you didn't add my fix for primary keys as it is blocked by earlier diffs from the stack so the primary keys cannot be figured out from the code)
  • go through the DB entities file - to figure out what are all fields in every one of them
  • considering how many tables you created, I'd have to do such a description myself to understand this(which is BTW an anti-pattern to create multiple tables for one service in dynamo DB without a really strong reason. It would be good to have a full DB description to rediscuss this).

Please, add a DB structure somewhere(or point it out if I'm not seeing it but it's somewhere there) so I can review this diff. Without it, I cannot see if the index you created is correct.

This revision now requires changes to proceed.Feb 17 2022, 1:24 AM
In D3239#86334, @karol-bisztyga wrote:

Hey @geekbrother is there anything like a DB structure schema described somewhere for the tunnelbroker? I bet you understand it, but it would be cool to have it in one place for other people. You can look at D2950 something like this would be great... It would be really helpful to review diffs like this and in general to understand how the service works. For now, if I want to figure this out, I have to:

  • go through the dynamo DB console on AWS - to see what's the primary keys(you didn't add my fix for primary keys as it is blocked by earlier diffs from the stack so the primary keys cannot be figured out from the code)
  • go through the DB entities file - to figure out what are all fields in every one of them
  • considering how many tables you created, I'd have to do such a description myself to understand this(which is BTW an anti-pattern to create multiple tables for one service in dynamo DB without a really strong reason. It would be good to have a full DB description to rediscuss this).

Please, add a DB structure somewhere(or point it out if I'm not seeing it but it's somewhere there) so I can review this diff. Without it, I cannot see if the index you created is correct.

That makes sense to me.
I've updated architecture review for the tunnelbroker. Please take a look at DynamoDB database model section.

max edited the summary of this revision. (Show Details)
tomek added 1 blocking reviewer(s): karol.

@karol-bisztyga it looks like this diff is waiting for your review

Accepting but I see 2 problems here:

  • I cannot see the index on the aws, is it there?
  • Is this index documented somewhere? From here we do not know what it projects, etc.

Maybe I missed something but would be cool to get responses to these questions before landing.

This revision is now accepted and ready to land.Mar 30 2022, 6:50 AM
In D3239#97178, @karol-bisztyga wrote:

Accepting but I see 2 problems here:

  • I cannot see the index on the aws, is it there?

Fixed, thanks!

  • Is this index documented somewhere? From here we do not know what it projects, etc.

I've updated the Tunnelbroker architecture review with the database model.

This revision is now accepted and ready to land.Apr 18 2022, 7:43 AM

Eventually the database model should be checked in and live in code (Terraform)

Fixed nit in a function name. Index name moved to the item along with the field names.

This revision now requires review to proceed.Apr 19 2022, 6:49 AM

Re-requesting review here because of some minor but changes:

  • Fixed a nit in a function name: Receiever -> Receiver.
  • Moved index name to the MessageItem along with the field constants.
max retitled this revision from [services][tunnelbroker] DatabaseManager method to find messages by the receiver. to [services][tunnelbroker] DatabaseManager method to find messages by the receiver.Apr 19 2022, 6:57 AM
max retitled this revision from [services][tunnelbroker] DatabaseManager method to find messages by the receiver to [services] Tunnelbroker - DatabaseManager method to find messages by the receiver.
tomek added 1 blocking reviewer(s): karol.

Looks ok. Added @karol-bisztyga as a blocking reviewer because he was reviewing the first revision.

How is ENG-751 related to this?

  • Is this index documented somewhere? From here we do not know what it projects, etc.

I've updated the Tunnelbroker architecture review with the database model.

Sorry, but I cannot see anything about this index in your arch review you posted :( Where is it? There's a DB model, but nothing about indexes is there.

I see however that you created this index on the AWS. So, based on what's there, I'm going to answer my question for you: the index projects all fields.

services/tunnelbroker/src/Database/MessageItem.h
28

Good idea to store indexes here

This revision is now accepted and ready to land.Apr 25 2022, 2:44 AM

Rebase on master to resolve merge conflicts.

In D3239#106211, @karol-bisztyga wrote:

How is ENG-751 related to this?

  • Is this index documented somewhere? From here we do not know what it projects, etc.

I've updated the Tunnelbroker architecture review with the database model.

Sorry, but I cannot see anything about this index in your arch review you posted :( Where is it? There's a DB model, but nothing about indexes is there.

I see however that you created this index on the AWS. So, based on what's there, I'm going to answer my question for you: the index projects all fields.

Good suggestion!
I've updated the database model with this index.

services/tunnelbroker/src/Database/MessageItem.h
28

Good idea to store indexes here

Thanks.