audius-protocol icon indicating copy to clipboard operation
audius-protocol copied to clipboard

Fixes for audio transaction history backfilling

Open dharit-tan opened this issue 2 years ago • 1 comments

Description

Fixes 2 major bugs in audio_transactions_history table backfilling (which are unfortunately already deployed):

  • Lock timeouts - originally there was a timeout on the indexing task lock which would allow a new task to grab the lock and begin indexing the same data. This would result in a race condition - one task would write out data to audio_transactions_history and whatever backfilling txs table it was using, then the other would try to write duplicate data and fail. Solution was to remove the timeouts.
  • Solana flakiness - calls to get_signatures_for_address was returning an empty list even though there were definitely prior signatures for the given program, even after increasing retries 10x. The indexer logic would erroneously treat this as the "beginning of time" for that program, and stop indexing at that point resulting in sometimes huge gaps in the indexed data. The solution was to hardcode the min_sig value (lowest known signature for the program) and check against that - if we encountered an empty list when we shouldn't have, fail out and restart the task.
  • Another small bug was a KeyError in helpers.py - switched to a for loop instead of using next.

Also added a db migration to delete all data associated with the backfilling so we can have a fresh start.

Tests

Tested on remote-dev with 3 DNs this time so we can check data consistency between them. Also tested on a prod sandbox.

Monitoring - How will this change be monitored? Are there sufficient logs / alerts?

Lots of logs, also switched to logger.info in index_spl_token_backfill.py for better visibility.

dharit-tan avatar Nov 21 '22 23:11 dharit-tan

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secret in your pull request
GitGuardian id Secret Commit Filename
5071455 Generic High Entropy Secret 39313655eff0e88e74c94249c566a22e213310cc discovery-provider/default_config.ini View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

Our GitHub checks need improvements? Share your feedbacks!

gitguardian[bot] avatar Nov 21 '22 23:11 gitguardian[bot]

@dharit-tan do we care about this PR still?

raymondjacobson avatar Jun 09 '23 22:06 raymondjacobson

@dharit-tan do we care about this PR still?

Nope, this code is deleted!

dharit-tan avatar Jun 12 '23 20:06 dharit-tan