Skip to content

uses MAX_LEADER_SCHEDULE_STAKES for cluster-nodes cache capacity#2151

Merged
behzadnouri merged 1 commit intoanza-xyz:masterfrom
behzadnouri:cluster-nodes-cache-num-epoch-cap
Jul 18, 2024
Merged

uses MAX_LEADER_SCHEDULE_STAKES for cluster-nodes cache capacity#2151
behzadnouri merged 1 commit intoanza-xyz:masterfrom
behzadnouri:cluster-nodes-cache-num-epoch-cap

Conversation

@behzadnouri
Copy link
Copy Markdown

Problem

Because of the TTL based eviction it does not make sense to cache more than MAX_LEADER_SCHEDULE_STAKES epochs.

Summary of Changes

Set CLUSTER_NODES_CACHE_NUM_EPOCH_CAP equal to MAX_LEADER_SCHEDULE_STAKES.

Some more context here: #1735 (comment)

Because of the TTL based eviction it does not make sense to cache more
than MAX_LEADER_SCHEDULE_STAKES epochs.
@behzadnouri behzadnouri requested a review from bw-solana July 17, 2024 01:47
Copy link
Copy Markdown

@bw-solana bw-solana left a comment

Choose a reason for hiding this comment

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

Looks good to me. Left one question

mod standard_broadcast_run;

const CLUSTER_NODES_CACHE_NUM_EPOCH_CAP: usize = 8;
const_assert_eq!(CLUSTER_NODES_CACHE_NUM_EPOCH_CAP, 5);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Why the assert? Are you worried about max leader schedule stakes adjusting up? If so, maybe we should min this with some constant cap?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Just as an explicit signal that if that constant is changed, it has ramifications here.
Also serves as a documentation that what the capacity actually is.

@behzadnouri behzadnouri merged commit 736bf93 into anza-xyz:master Jul 18, 2024
@behzadnouri behzadnouri deleted the cluster-nodes-cache-num-epoch-cap branch July 18, 2024 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants