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 db error #450

Merged
merged 2 commits into from
Jul 14, 2022
Merged

Fix db error #450

merged 2 commits into from
Jul 14, 2022

Conversation

Neylix
Copy link
Member

@Neylix Neylix commented Jul 13, 2022

Description

Sometimes, we receveive message from different node asking to write a transaction in the DB. There is some case where the transaction is written 2 times in the DB and sometimes corrupt the file and so DB could not anymore read it.

So the idea is to create a queue that block the writing of a transaction if a writing is already happening on the same file.

Fixes #434

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

I added some log in the DB and we could see that their were mutiple transaction writing on the same file at the same time.
After update, mutuple writing on the same file are blocked and processed consecutively. So the error do not happen anymore.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@Neylix Neylix requested a review from apoorv-2204 July 13, 2022 23:59
Add a queue in DB to prevent writing the same transaction many times when there is mutiple write request on the same file
@apoorv-2204
Copy link
Contributor

Does it really worked?

@apoorv-2204
Copy link
Contributor

yay!!

@apoorv-2204
Copy link
Contributor

What about this? May be this, what do you think?

  • Addition of check ChainIndex.transaction_exists, in write_transaction, to avoid multiple times writing of same transaction due to beacon transaction notification from other nodes. Under Subset code , write_transaction was being deployed with out any checks of transaction already exists, causing nb of nodes = nb of times same transactions written.
  • 🗄️ , In file writer appending transaction, was not sequential resulting in corrupt chain file. If multiple transactions were deployed for same genesis address, then chain writer was deployed without any synchronous behaviour resulting in writing the same file which is being written by other process to same transaction file

@apoorv-2204 apoorv-2204 added bug Something isn't working P2P Involve P2P networking transaction Involve transactions beacon chain Involve BeaconChain DB Involve database testing Improve testing core team Assigned to the core team to-analyze labels Jul 14, 2022
@Neylix Neylix merged commit a76c968 into archethic-foundation:develop Jul 14, 2022
@Neylix Neylix deleted the Fix-DB-error branch July 14, 2022 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beacon chain Involve BeaconChain bug Something isn't working core team Assigned to the core team DB Involve database P2P Involve P2P networking testing Improve testing to-analyze transaction Involve transactions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants