Skip to content

Conversation

shargon
Copy link
Member

@shargon shargon commented Feb 11, 2025

Description

ChangeSet was removed when the Storage is readOnly, calls to NeoSystem.StoreView will be improved.

Fixes # (issue)

Type of change

  • Optimization (the change is only an optimization)
  • Style (the change is only a code style for better maintenance or standard purpose)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • Current tests

Test Configuration:

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my 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

@shargon shargon marked this pull request as ready for review February 11, 2025 12:48
@shargon shargon changed the title Speed up Read only storage Remove ChangeSet from StoreView Feb 11, 2025
@shargon shargon added the Blocker Issues that are blocking other issues. Check issues details to see what it is blocking. label Feb 13, 2025
@shargon
Copy link
Member Author

shargon commented Feb 13, 2025

I need this for StorageCache, because when is ReadOnly, the cache must write in the main one, instead of the temporal, otherwise we dont' have a good performance

Related to: #3669

@shargon shargon requested a review from superboyiii February 14, 2025 12:11
@shargon
Copy link
Member Author

shargon commented Feb 14, 2025

@superboyiii could you test it?

@shargon
Copy link
Member Author

shargon commented Feb 22, 2025

Ping @neo-project/core

protected DataCache(bool readOnly)
{
if (!readOnly)
_changeSet = [];
Copy link
Contributor

Choose a reason for hiding this comment

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

is this the same as _changeSet = null; ?

cause you have public bool IsReadOnly => _changeSet == null;

Copy link
Contributor

Choose a reason for hiding this comment

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

is this the same as _changeSet = null; ?

cause you have public bool IsReadOnly => _changeSet == null;

Line 87 creates an empty set

Copy link
Member Author

Choose a reason for hiding this comment

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

Starting being null

@shargon
Copy link
Member Author

shargon commented Feb 28, 2025

@neo-project/core someone can review it?

Copy link
Member

@cschuchardt88 cschuchardt88 left a comment

Choose a reason for hiding this comment

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

This affects the core functionality of the node. I request a benchmark and need more tests.

@shargon
Copy link
Member Author

shargon commented Mar 2, 2025

This affects the core functionality of the node. I request a benchmark and need more tests.

What test do you need? it's already tested the exception while is commited in real only mode

@shargon
Copy link
Member Author

shargon commented Mar 4, 2025

@cschuchardt88 take into account that this is not only an optimization, this disable the possibility of commit in a read only data view, something that never should happen, and before this pr, can be done

@NGDAdmin NGDAdmin merged commit be1c7da into master Mar 5, 2025
6 of 7 checks passed
@NGDAdmin NGDAdmin deleted the avoid-change-set-from-readonly branch March 5, 2025 08:38
cschuchardt88 added a commit to cschuchardt88/neo that referenced this pull request Jun 8, 2025
* Speed up Read only storage

* Add ut

* Fix ut

* Format

* Fix CloneCache

* Rename

* change error message

* Fix clone cache tests

* Fix merge

* Update UT_MemoryStore.cs

* Fix build

* Update src/Neo/Persistence/StoreCache.cs

---------

Co-authored-by: Jimmy <[email protected]>
Co-authored-by: Christopher Schuchardt <[email protected]>
Co-authored-by: NGD Admin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Blocker Issues that are blocking other issues. Check issues details to see what it is blocking. Ready to Merge Waiting for Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants