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

Avoid importing internal_transactions of pending transactions #2523

Merged
merged 2 commits into from
Aug 8, 2019

Conversation

pasqu4le
Copy link
Contributor

@pasqu4le pasqu4le commented Aug 7, 2019

Solves:

application=indexer fetcher=internal_transaction step=internal_transactions_indexed_at_transactions
count=10 error_count=10 [error] failed to import internal transactions for transactions:
%{exception: %Postgrex.Error{connection_id: 25257, message: nil, postgres: %{code:
:check_violation, constraint: "status", detail: "Failing row contains (null, null, 
[...]

Motivation

The problem happens because while fetching internal transactions for a block sometimes we receive some that are part of a pending transaction (or at least a transaction that is still registered in the database as pending).
By inserting them we also try to update the pending transaction's field, but this violates the status check constraint (and rightfully so).

Changelog

Bug Fixes

The solution is to filter out internal_transactions that are part of a pending transaction before trying to insert them.

Checklist for your PR

@pasqu4le pasqu4le self-assigned this Aug 7, 2019
Problem: While fetching the internal transactions for a block sometimes we receive some that are part of a pending transaction.
By inserting them we also try to update the pending transaction's field, but this violates the `status` check constraint (rightfully).

Solution: Filter out internal_transactions that are part of a pending transaction.
@pasqu4le pasqu4le force-pushed the pp-avoid-inserting-pending-internal-transactions branch from 6d0e8d9 to 52a0b19 Compare August 7, 2019 17:35
@pasqu4le pasqu4le added ready for review This PR is ready for reviews. and removed in progress labels Aug 7, 2019
@coveralls
Copy link

Pull Request Test Coverage Report for Build 054780bf-8506-4ac2-b34e-4264de6ea16c

  • 7 of 7 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.02%) to 79.307%

Totals Coverage Status
Change from base Build 5bb5bf01-fa26-4c36-9e25-d26613662757: 0.02%
Covered Lines: 5170
Relevant Lines: 6519

💛 - Coveralls

@vbaranov vbaranov merged commit edd6819 into master Aug 8, 2019
@vbaranov vbaranov deleted the pp-avoid-inserting-pending-internal-transactions branch August 8, 2019 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready for review This PR is ready for reviews.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants