Skip to content

feat: Remove Last Cache Size Limitation#26333

Merged
peterbarnett03 merged 5 commits intomainfrom
pbarnett/remove-last-cache-limit
Apr 28, 2025
Merged

feat: Remove Last Cache Size Limitation#26333
peterbarnett03 merged 5 commits intomainfrom
pbarnett/remove-last-cache-limit

Conversation

@peterbarnett03
Copy link
Copy Markdown
Contributor

@peterbarnett03 peterbarnett03 commented Apr 26, 2025

Removes limitation on cache size of 10 for Last Value Cache.

  • Remove limiting code
  • Update CLI information (with caution on higher use)
  • Update tests for higher use, and invalid use of 0

Additionally, closes #25522

Copy link
Copy Markdown
Member

@pauldix pauldix left a comment

Choose a reason for hiding this comment

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

Just a couple of small things

Copy link
Copy Markdown
Contributor

@hiltontj hiltontj left a comment

Choose a reason for hiding this comment

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

I left one comment in addition to Paul's - what I suggested isn't a blocking request though, but using NonZeroUsize (or NonZeroU64) might be useful for catching some corner cases but generally, the code as is should enforce the greater than 0 restrictions fine.

Comment on lines +385 to 387
/// Must be greater than 0
#[derive(Debug, Serialize, Eq, PartialEq, Clone, Copy)]
pub struct LastCacheSize(pub(crate) usize);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is a textbook use case for NonZeroUsize, i.e.,

/// Must be greater than 0
#[derive(Debug, Serialize, Eq, PartialEq, Clone, Copy)]
pub struct LastCacheSize(pub(crate) NonZeroUsize);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This looks like it'll be more involved given implementations across the DB will have to be updated; I can do that update, would want to do it in a separate chore though if that's alright.

If you've reconsidered and do think it should be blocking, let me know and I'll make the update.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No worries. We can refactor this later

@peterbarnett03 peterbarnett03 merged commit 6a67434 into main Apr 28, 2025
13 checks passed
@peterbarnett03 peterbarnett03 deleted the pbarnett/remove-last-cache-limit branch April 28, 2025 22:41
hiltontj pushed a commit that referenced this pull request May 2, 2025
* feat: remove limit on LVC size

* fix: bad test case and incorrect info

* fix: more clarity and default value

* fix: light CLI polishes

* fix: bad snapshot
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.

Error on last cache create should state size limit

3 participants