[Feature] Graceful Application Shutdown #50

Closed
opened 2022-05-25 13:23:51 +00:00 by abdulrabbani00 · 1 comment
abdulrabbani00 commented 2022-05-25 13:23:51 +00:00 (Migrated from github.com)

Table of contents generated with markdown-toc

Overview

Request

When we shut the application down, we need to ensure that it releases any "locks" to database rows. This is critical, without a doubt. If we shutdown the application without reverting the checked_outrow, we run the risk of having orphan columns.

Potential Solution

  • An easier solution would be to add a column to each table that has a checked_out column. Something like, lock_holder_identifier.
  • Every instance of the application running would have a unique identifier that would be configured.
  • When the application shuts down, it can simply update all the tables to checked_out = false where lock_holder_identifier is their number.
  • This can be a bit of a slippery slope as we have to be mindful of giving each instance a unique identifier (or creating a random one on the fly).

Alternative Solutions

  • We can create a mapping of slots that have been locked.
  • When we shut down, we can turn all columns back from checked_out: true --> checked_out: false.

Additional Context

- [Overview](#overview) - [Request](#request) - [Potential Solution](#potential-solution) - [Alternative Solutions](#alternative-solutions) - [Additional Context](#additional-context) <small><i><a href='http://ecotrust-canada.github.io/markdown-toc/'>Table of contents generated with markdown-toc</a></i></small> # Overview - **Requester**: @abdulrabbani00 - **Epic Link**: https://github.com/vulcanize/ipld-ethcl-indexer/issues/42 ## Request <!--- Explain what you want and why. If this feature is related to a problem please highlight it here.** ---> When we shut the application down, we need to ensure that it releases any "locks" to database rows. This is critical, without a doubt. If we shutdown the application without reverting the `checked_out`row, we run the risk of having orphan columns. # Potential Solution <!---Provide any details for a potential solution. ---> * An easier solution would be to add a column to each table that has a `checked_out` column. Something like, `lock_holder_identifier`. * Every instance of the application running would have a unique identifier that would be configured. * When the application shuts down, it can simply update all the tables to `checked_out = false` where `lock_holder_identifier` is their number. * This can be a bit of a slippery slope as we have to be mindful of giving each instance a unique identifier (or creating a random one on the fly). ## Alternative Solutions <!---Provide any alternative solutions. ---> * We can create a mapping of slots that have been locked. * When we shut down, we can turn all columns back from `checked_out: true` --> `checked_out: false`. # Additional Context <!---Provide Additional Context. --->
abdulrabbani00 commented 2022-05-25 14:24:07 +00:00 (Migrated from github.com)

I will be proceeding with the alternative solution. It's easier to implement, provide flexibility at this stage, and will be easier to study.

We can reconsider this solution down the road if needed.

I will be proceeding with the alternative solution. It's easier to implement, provide flexibility at this stage, and will be easier to study. We can reconsider this solution down the road if needed.
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: cerc-io/ipld-eth-beacon-indexer#50
No description provided.