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

Fix for fork handling issues #1083

Merged
merged 11 commits into from
Jun 29, 2022
Merged

Fix for fork handling issues #1083

merged 11 commits into from
Jun 29, 2022

Conversation

piotrkosecki
Copy link
Contributor

There were three problems:

  1. Not consistent invalidation - when the fork information was inserted the DB was checking immediately for foreign keys and that was breaking it because it should wait till the end of transaction. Those changes in schema fixed this issue:
DEFERRABLE INITIALLY DEFERRED;
  1. Duplicate error when invalidating tables - problem was when one of the blocks was previously invalidated and had the same or greater block level than current invalidation(it can happen when for example node is not consistent with replacing blocks and first changes block that was higher and then changes lower block). Fix for this is to invalidate only entries with leader/Main fork_id. This fixes the issue:
.filter(x => levelColumn(x) >= fromLevel && forkIdColumn(x) === Fork.mainForkId)
  1. Starting from the old head. After fork invalidation we were using the same hade as before the invalidation. Meaning we would continue fetching blocks like nothing happened and we would have big hole in the valid blocks. This fixes it:
maxLevelNew <- indexedData.fetchMaxLevel

Also I've added more logging and set fork handling to true by default.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 4, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@vishakh vishakh added this to the 2022_r3 milestone Apr 22, 2022
@vishakh vishakh added the bug label Apr 22, 2022
@vishakh vishakh removed this from the 2022_r3 milestone Jun 20, 2022
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@vishakh vishakh added this to the 2022_r4 milestone Jun 29, 2022
@vishakh vishakh merged commit 48c6beb into master Jun 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants