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

Add read threads to storagev2 leveldb unit test #188

Merged
merged 3 commits into from
Apr 2, 2024

Conversation

oliverbundalo
Copy link

Description

Unit test for storagev2 levekdb has been modified to have threads reading database in parallel.

Changes include

  • Bugfix (non-breaking change that solves an issue)
  • Hotfix (change that solves an urgent issue, and requires immediate attention)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (change that is not backwards-compatible and/or changes current functionality)

Breaking changes

Please complete this section if any breaking changes have been made, otherwise delete it

Checklist

  • I have assigned this PR to myself
  • I have added at least 1 reviewer
  • I have added the relevant labels
  • I have updated the official documentation
  • I have added sufficient documentation in code

Testing

  • I have tested this code with the official test suite
  • I have tested this code manually

Manual tests

Please complete this section if you ran manual tests for this functionality, otherwise delete it

Documentation update

Please link the documentation update PR in this section if it's present, otherwise delete it

Additional comments

Please post additional comments in this section if you have them, otherwise delete it

@oliverbundalo oliverbundalo added the enhancement New feature or request label Apr 2, 2024
@oliverbundalo oliverbundalo self-assigned this Apr 2, 2024
blockchain/storagev2/leveldb/leveldb_test.go Outdated Show resolved Hide resolved
require.NoError(t, batchWriter.WriteBatch())

size := dirSize(t, path)
writeBlock(t, s, b)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is writing blocks also a thread-safe operation? I'm aware that in the practice, there shouldn't be multiple writers, but however, if it is a thread-safe operation it would be nice to have a test where there are multiple readers and writers in parallel.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Request was to have one thread to write into database and multiple concurrent readers, which should correspond to real use case.

@oliverbundalo oliverbundalo merged commit 1b47a22 into develop Apr 2, 2024
10 checks passed
@oliverbundalo oliverbundalo deleted the feat-extend-db-tests branch April 2, 2024 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants