You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Also, when calling this from a main thread, we should check the shard cache when blocking_get returns None. Due to forks, there can be multiple main threads and in that case the fetched value will be in the shard cache. Only if that also fails should we go and fetch the data from DB.
Part of #7723
This PR replaces busy waiting loop with update notifications on every underlying map update. It introduces single condition variable which is notified on every map update. One considered alternative is to maintain separate condition variable per slot to have more granular notifications. In practice this doesn't make any difference since additional iterations for irrelevant keys wouldn't cause any noticeable performance overhead, but it results in more complex and harder to reason about code.
This busy loop was a quick hack to write simpler code under time pressure. Let's replace it with a proper design, such as a Condvar..
nearcore/core/store/src/trie/prefetching_trie_storage.rs
Lines 330 to 339 in aad3bf2
Also, when calling this from a main thread, we should check the shard cache when
blocking_get
returns None. Due to forks, there can be multiple main threads and in that case the fetched value will be in the shard cache. Only if that also fails should we go and fetch the data from DB.nearcore/core/store/src/trie/trie_storage.rs
Lines 528 to 538 in aad3bf2
The only other call-site is here:
nearcore/core/store/src/trie/prefetching_trie_storage.rs
Lines 240 to 264 in aad3bf2
The text was updated successfully, but these errors were encountered: