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

chore: Remove manual memory management from stats #2550

Merged
merged 1 commit into from
Feb 10, 2024

Conversation

dranikpg
Copy link
Contributor

@dranikpg dranikpg commented Feb 6, 2024

Cleans up #2328

Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
@dranikpg dranikpg changed the title chore: Fix stats mess chore: Remove manual memory management from stats Feb 6, 2024
ServerState::Stats& ServerState::Stats::Add(unsigned num_shards, const ServerState::Stats& other) {
static_assert(sizeof(Stats) == 13 * 8, "Stats size mismatch");
ServerState::Stats& ServerState::Stats::Add(const ServerState::Stats& other) {
static_assert(sizeof(Stats) == 14 * 8, "Stats size mismatch");
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this assertion is better move under the Stats definition

Copy link
Contributor

Choose a reason for hiding this comment

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

and instead of 8 use sizeof(int64_t)

for (unsigned i = 0; i < num_shards; ++i) {
this->tx_width_freq_arr[i] += other.tx_width_freq_arr[i];
}
this->tx_width_freq_arr = other.tx_width_freq_arr;
Copy link
Contributor

Choose a reason for hiding this comment

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

should never happen

@dranikpg dranikpg closed this Feb 6, 2024
@dranikpg dranikpg deleted the fix-stats branch February 6, 2024 19:02
@dranikpg dranikpg restored the fix-stats branch February 9, 2024 16:15
@dranikpg dranikpg reopened this Feb 9, 2024
@dranikpg
Copy link
Contributor Author

dranikpg commented Feb 9, 2024

Accidentally deleted this branch 😬

@dranikpg dranikpg merged commit 815976c into dragonflydb:main Feb 10, 2024
10 of 14 checks passed
@dranikpg dranikpg deleted the fix-stats branch February 20, 2024 16:48
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