Speed up reverts

Ouverte
#1,705 1 commentaire 1 réaction 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Évaluation

Difficulté
5/5
Temps estimé
Plus d'une semaine
Accessibilité débutants
30/100
Type d'issue
Fonctionnalité
Clarté
À clarifier
Activité
À l'abandon
Stack technique
rust, sql

Piste de recherche

Commencez par profiler les requêtes actuelles d’annulation de blocs de graph-node et par les comparer à des requêtes limitées aux IDs de version des entités affectées (vid). Utilisez ces mesures pour déterminer la structure des données en mémoire par bloc et la limite de rétention ; le travail est considéré comme terminé lorsqu’une amélioration mesurée de la vitesse d’annulation est obtenue et que le comportement existant reste disponible lorsqu’il n’y a pas de données.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

area/indexing ops performance

For some subgraphs, reverting blocks is still slow. The best way to speed this up might be to restrict the queries we run to revert the block by the vid of the entity versions that are actually affected by the revert. To facilitate that, graph-node should keep a list of the vid's of entities by block in memory as it moves forward and processes blocks. That list can then be used to speed up reverts.

Even if we only keep this data for a small number of blocks (say 5), it should help in speeding up reverts already. It's ok if we do not have that data for a revert (e.g., after a cold start), we can just fall back to the current behavior. The amount of data to keep should be relatively small, as mappings typically only alter a small number of entities for each block, but we might want to limit this by only keeping the data if there are fewer than N vid's to keep for a block.

Before implementing this, we should analyze the performance of the current queries and compare it to the performance of queries including the vid of the entities affected by the rollback. That should also inform the shape of the data we keep in memory, but will likely look like this for the different operations in a specific block:

  • create: remember the vid of the new entity
  • update: remember the vid of the old and the new version of the entity
  • delete: remember the vid of the deleted entity version

During a revert, we'd then use this information to narrow down which rows in a table to change, for example the query to delete entity versions that are now in the future would become

delete from things where vid in ($vids)

where vids contains what we recorded as new versions for a create or update

Langage dominant
Rust
Étoiles
3.2k
Forks
1.1k
Merge moyen
4 j 1 h
PR mergées (30 j)
1

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de graphprotocol/graph-node

Toutes les issues de graphprotocol/graph-node

Issues similaires

Plus d'issues Rust

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.