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

Make keystat localized to store instance #755

Merged
merged 5 commits into from
Sep 29, 2024

Conversation

soumya-codes
Copy link
Contributor

As we move to multi-threading we need to localize the keystats store from being global which is the case today.

Signed-off-by: soumya-codes <151079203+soumya-codes@users.noreply.github.com>
Comment on lines -21 to -29
func RespINFO(args []string) []byte {
var info []byte // Initialize a byte slice to hold the keyspace info.
buf := bytes.NewBuffer(info) // Create a buffer for efficiently writing the response.
buf.WriteString("# Keyspace\r\n") // Write the header "# Keyspace" to indicate the section for keyspace stats.
for i := range dstore.KeyspaceStat { // Iterate through the KeyspaceStat map, which holds the number of keys per database.
fmt.Fprintf(buf, "db%d:keys=%d,expires=0,avg_ttl=0\r\n", i, dstore.KeyspaceStat[i]["keys"]) // Format the keyspace info for each database.
}
return clientio.Encode(buf.String(), false) // Encode the result into a Redis protocol-compliant format and return the encoded bytes.
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just for my understanding, do we not need this anymore?

Copy link
Contributor

Choose a reason for hiding this comment

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

This should still be here. However, since this becomes a multi-shard command, maybe that's why he's removing it for now, is my guess.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I had removed this as it is a multi-key command...

@lucifercr07 lucifercr07 merged commit f7a2856 into DiceDB:master Sep 29, 2024
1 of 2 checks passed
lucifercr07 added a commit to lucifercr07/dice that referenced this pull request Sep 30, 2024
@soumya-codes soumya-codes deleted the soumya-codes/localize-keystat branch October 2, 2024 06:37
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.

4 participants