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

Handle unsynced deployers #99

Closed
bakhshandeh opened this issue May 13, 2023 · 3 comments
Closed

Handle unsynced deployers #99

bakhshandeh opened this issue May 13, 2023 · 3 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@bakhshandeh
Copy link
Member

Our system relies on the assumption that every deployer node has access to the complete and updated data. However, this assumption may be violated if a new deployer joins the network or an existing deployer goes offline and misses some updates. In such cases, the deployer's database may be out of sync and may return inaccurate data to the callers

@bakhshandeh bakhshandeh added this to the PION Launch milestone Jun 16, 2023
@bakhshandeh
Copy link
Member Author

How to implement?

1- A new plugin (deployers-sync or tier3-sync) that runs only on the deployers. It can be disabled on other nodes or it can run but do nothing.

2- A new table (Settings) will be added to the persistent database (MongoDB) to allow the module to save the timestamp of the latest context in the database.

{
'deployers-sync.last_timestamp': 1234
}

Other necessary settings also can be saved into this table by other plugins.

3- The plugin calls an endpoint or a lip2p protocol on a few random deployers and passes the latest timestamp to see if there are any new contexts that need to be saved.

4- If there is any new context, they will be saved and `Settings.deployers-sync.last_timestamp' will be updated

Notes

  • In some cases, a node needs to recover its database from scratch. deployers-sync.last_timestamp is null and the plugin should request data from the beginning. We should add pagination and let the node sync, for example, the first 100 contexts first and update deployers-sync.last_timestamp. Then another page will be requested based on deployers-sync.last_timestamp, and so on.

  • This plugin could be merged with db-sync if there are many redundant parts.

  • A single or a few dishonest deployers should not be able to send incorrect data to other nodes.

@sadeghte
Copy link
Member

Sometimes, a node may have the latest context but not some of the previous ones. This can happen if a node is offline for a period and then comes back online. If a new deployment occurs before the node recovery process start, none of the previous contexts will be restored.

@sadeghte sadeghte self-assigned this Jun 21, 2023
@sadeghte sadeghte added the bug Something isn't working label Jun 21, 2023
@bakhshandeh
Copy link
Member Author

a new deployment occurs before the node recovery process start, none of the previous contexts will be restored.

We do not update deployers-sync.last_timestamp on deployment. It will be updated only when deployers-sync runs.

sadeghte added a commit that referenced this issue Jun 23, 2023
sadeghte added a commit that referenced this issue Jun 24, 2023
bakhshandeh added a commit that referenced this issue Jun 24, 2023
sadeghte added a commit that referenced this issue Jun 24, 2023
bakhshandeh added a commit that referenced this issue Jun 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants