-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Make keystat localized to store instance #755
Conversation
Signed-off-by: soumya-codes <151079203+soumya-codes@users.noreply.github.com>
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. | ||
} |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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...
This reverts commit f7a2856.
As we move to multi-threading we need to localize the keystats store from being global which is the case today.