Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: simplify migration scripts and remove store legacy code #2894

Conversation

Ivansete-status
Copy link
Collaborator

Description

  • Simplify the migration scripts thanks to already having the timestamp data within the storedAt column.
  • Remove all the store legacy code as we are switching to store-v3 only

@Ivansete-status Ivansete-status self-assigned this Jul 10, 2024
Copy link

github-actions bot commented Jul 10, 2024

You can find the image built from this PR at

quay.io/wakuorg/nwaku-pr:2894

Built from 27441e6

@Ivansete-status Ivansete-status marked this pull request as ready for review July 11, 2024 10:59
Copy link
Contributor

@SionoiS SionoiS left a comment

Choose a reason for hiding this comment

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

1000% Simpler but is it no longer a requirement to be backward compatible?

As for the migration, old messages timestamp would be all different after the migration would that not affect Status?

@Ivansete-status
Copy link
Collaborator Author

1000% Simpler but is it no longer a requirement to be backward compatible?

As for the migration, old messages timestamp would be all different after the migration would that not affect Status?

I think we are aiming for not backward compatible changes and the same happens in the Status changes. @richard-ramos - correct me if I'm wrong

Copy link
Contributor

@gabrielmer gabrielmer left a comment

Choose a reason for hiding this comment

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

Ooh super happy to finally remove legacy store! We should also make sure tu remove it from the API documentation in https://github.com/waku-org/waku-rest-api

Regarding the migration script, there's something I don't quite understand.
Why are we dropping timestamp and renaming storedAt to timestamp instead of just dropping storedAt? are the current values in timestamp wrong?

gabrielmer

This comment was marked as duplicate.

@Ivansete-status
Copy link
Collaborator Author

Ooh super happy to finally remove legacy store! We should also make sure tu remove it from the API documentation in https://github.com/waku-org/waku-rest-api

Thanks for the reminder!

Regarding the migration script, there's something I don't quite understand. Why are we dropping timestamp and renaming storedAt to timestamp instead of just dropping storedAt? are the current values in timestamp wrong?

Both timestamp and storedAt fields keep exactly the same values. We can't remove the storedAt attribute first because it is part of the PK and hence we apply that movement.

@gabrielmer gabrielmer self-requested a review July 11, 2024 12:44
Copy link
Contributor

@gabrielmer gabrielmer left a comment

Choose a reason for hiding this comment

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

Amazing! Thanks so much! 😍

@richard-ramos
Copy link
Member

Even tho status-go will then use v3 once PR status-im/status-go#5123 is merged, existing users that have not updated their status-app will continue to use storeV2 (since that's what their app's status-go version will use), so I'm not sure we should remove the legacy code yet, but keep it instead for a couple of months.

@Ivansete-status
Copy link
Collaborator Author

Thanks for the comment @richard-ramos !
Therefore, we need to keep the support to store-v2 until Stauts users have switched to store-v3 ( we consider at least one 6 weeks ( one Status release period ) of having the option to use store-v3 .)

Copy link
Contributor

@NagyZoltanPeter NagyZoltanPeter left a comment

Choose a reason for hiding this comment

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

LGTM, yeah would have been to easy step to remove store v2 for now. But will come!

The id column is needed because it contains the message digest
which is used in store v2, and we need to keep support to
store v2 for a while
We want the nwaku node to simultaneously support store-v2
requests and store-v3 requests.

Only legacy archive is in charge to archiving messages, and the
archived information is suitable to fulfill both store-v2 and
store-v3 needs.
Copy link

This PR may contain changes to database schema of one of the drivers.

If you are introducing any changes to the schema, make sure the upgrade from the latest release to this change passes without any errors/issues.

Please make sure the label release-notes is added to make sure upgrade instructions properly highlight this change.

@Ivansete-status
Copy link
Collaborator Author

1000% Simpler but is it no longer a requirement to be backward compatible?

Thanks again for the comments @SionoiS !
May take another look plz guys?

In the current changes we are simultaneously supporting store-v2 and store-v3

( cc @NagyZoltanPeter @gabrielmer )

Copy link
Contributor

@gabrielmer gabrielmer left a comment

Choose a reason for hiding this comment

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

Amazingg PR! Really ingenious workaround to support simultaneously both store versions and keep the code nice and clean :)

Added just a small question and a super nitpick comment

waku/factory/node_factory.nim Outdated Show resolved Hide resolved
let rateLimitSetting: RateLimitSetting =
(conf.requestRateLimit, chronos.seconds(conf.requestRatePeriod))

try:
await mountLegacyStore(node, rateLimitSetting)
Copy link
Contributor

Choose a reason for hiding this comment

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

Here we are calling mountLegacyStore(node, rateLimitSetting) even in the cases of conf.legacyStore being false. Is this expected?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for that! It is corrected in 5b9871b

Ivansete-status and others added 2 commits July 12, 2024 13:28
@gabrielmer gabrielmer self-requested a review July 12, 2024 11:50
@Ivansete-status Ivansete-status merged commit 16b692c into chore--archive-drivers-refactor Jul 12, 2024
8 of 10 checks passed
@Ivansete-status Ivansete-status deleted the chore--archive-drivers-refactor-2 branch July 12, 2024 12:57
Ivansete-status added a commit that referenced this pull request Jul 12, 2024
* posgres legacy: stop using the storedAt field
* migration script 6: we still need the id column
  The id column is needed because it contains the message digest
  which is used in store v2, and we need to keep support to
  store v2 for a while
* legacy archive: set target migration version to 6
* waku_node: try to use wakuLegacyArchive if wakuArchive is nil
* node_factory, waku_node: mount legacy and future store simultaneously
  We want the nwaku node to simultaneously support store-v2
  requests and store-v3 requests.
  Only the legacy archive is in charge of archiving messages, and the
  archived information is suitable to fulfill both store-v2 and
  store-v3 needs.
* postgres_driver: adding temporary code until store-v2 is removed

---------

Co-authored-by: gabrielmer <101006718+gabrielmer@users.noreply.github.com>
@Ivansete-status Ivansete-status restored the chore--archive-drivers-refactor-2 branch July 12, 2024 13:37
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.

5 participants