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

Make Elasticsearch index robust to crashing #242

Open
nick8325 opened this issue Feb 6, 2024 · 0 comments
Open

Make Elasticsearch index robust to crashing #242

nick8325 opened this issue Feb 6, 2024 · 0 comments

Comments

@nick8325
Copy link
Contributor

nick8325 commented Feb 6, 2024

Currently the process for adding entries goes as follows:

  1. Add them to MariaDB
  2. Commit
  3. Add them to Elasticsearch

The problem is that if the backend crashes while adding the entries to Elasticsearch, we will have entries in MariaDB but not in Elasticsearch. (Note this can't be solved by swapping step 2 and 3, because if we crash while adding entries to Elasticsearch, we will have the opposite problem, entries in Elasticsearch but not MariaDB.)

One option for solving: create a new table in MariaDB of "recently added/deleted entries". We sync MariaDB to Elasticsearch by adding/removing the entries in this table to the index, then (when everything is done) emptying the table.

Another option: the index remembers what "revision" the repository was at when it was last synced (e.g., the max history_id in the entries table). Then to sync, we ask the database "give me all changes since this revision", and add/remove those to the index.

If the backend crashes during this process, it's OK - it just means that we will add/remove the synced entries again when we restart the backend.

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

No branches or pull requests

1 participant