Skip to content

Conversation

@odesenfans
Copy link
Collaborator

Reduced the data usage of the forget handler in two ways.

  1. Stop relying on get_message_content to retrieve the content
    of a message. As the message is guaranteed to already be on
    the node, we can directly get the parts of interest from the DB.

  2. Only retrieve the fields relevant to the handling of the forget
    message from the DB. Rather than retrieving the whole content,
    which can be quite large, we now only retrieve the address, item
    type and item hash from the DB. This should improve the performance
    of the handler. Introduced a new class, TargetMessageInfo, to
    represent the data we fetch from the DB.

@odesenfans odesenfans requested a review from hoh May 17, 2022 13:55
@odesenfans odesenfans added this to the May release milestone May 17, 2022
@odesenfans odesenfans force-pushed the od-fetch-less-data-in-forget branch from feba6c0 to 3f5c5a0 Compare May 24, 2022 10:02
Copy link
Member

@hoh hoh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not a big fan of redefining multiple Message types recent PRs, but that can always be improved later and this PR improves over the current situation.

A few minor comments but nothing blocking or consequent.

or target_info.content_item_hash is None
):
raise ValueError(
f"Could not garbage collect content linked to STORE message {target_hash}."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make this message more explicit ? Something like:

Suggested change
f"Could not garbage collect content linked to STORE message {target_hash}."
f"Information missing, could not garbage collect content linked to STORE message {target_hash}."

or target_info.content_item_hash is None
):
raise ValueError(
f"Could not garbage collect content linked to STORE message {target_hash}."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why put the target_hash in the string and not as another argument ?

Suggested change
f"Could not garbage collect content linked to STORE message {target_hash}."
f"Could not garbage collect content linked to STORE message", target_hash

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually never passed several values to ValueError, I see that it works (it makes the args property a tuple), is there an upside in doing this besides avoiding the string formatting?

@hoh hoh assigned odesenfans and unassigned hoh May 24, 2022
@odesenfans odesenfans assigned hoh and unassigned odesenfans May 24, 2022
Reduced the data usage of the forget handler in two ways.

1. Stop relying on `get_message_content` to retrieve the content
of a message. As the message is guaranteed to already be on
the node, we can directly get the parts of interest from the DB.

2. Only retrieve the fields relevant to the handling of the forget
message from the DB. Rather than retrieving the whole content,
which can be quite large, we now only retrieve the address, item
type and item hash from the DB. This should improve the performance
of the handler. Introduced a new class, `TargetMessageInfo`, to
represent the data we fetch from the DB.
@odesenfans odesenfans force-pushed the od-fetch-less-data-in-forget branch from 59f44b1 to ccf56f0 Compare May 25, 2022 09:31
@odesenfans odesenfans merged commit 0e9f957 into aleph-im:dev May 25, 2022
@odesenfans odesenfans deleted the od-fetch-less-data-in-forget branch May 25, 2022 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants