-
Notifications
You must be signed in to change notification settings - Fork 403
RI-6658: fallback to HELLO command when INFO is disabled via ACL #4377
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
Conversation
redisinsight/api/src/modules/database/providers/database-info.provider.ts
Outdated
Show resolved
Hide resolved
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.
I'm not sure that using DatabaseInfoProvider
will be easy in all app modules. I assume we might have a lot of circular dependencies then. Let's move this logic to RedisClient so it will be available everywhere. wdyt?
redisinsight/api/src/modules/database/providers/database-info.provider.ts
Outdated
Show resolved
Hide resolved
['info', 'server'], | ||
{ replyEncoding: 'utf8' }, | ||
) as string); | ||
const info = await client.getInfo(true, 'server'); |
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.
Let's avoid getting various info sections avross the app.
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.
Why though? Preserving the behavior is one thing, but I figured querying just specific sections should be faster. E.g. if we have an interval, querying the data and only carrying about one section it would make sense to only query that section. I might be wrong, let me know.
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.
I don't think this slightly impact performance. Just don't like idea of merging objects in getInfo
funciton.
If we want to stay with this logic we should enhance getInfo
command to reply only particular section as it works now (most probably without storing it)
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.
refactored; I've removed the stored info object
['info', 'server'], | ||
{ replyEncoding: 'utf8' }, | ||
) as string); | ||
const reply = await client.getInfo(); |
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.
like here
{ replyEncoding: 'utf8' }, | ||
) as string, | ||
); | ||
const info = await redisClient.getInfo(true, 'clients'); |
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.
clients
{ replyEncoding: 'utf8' }, | ||
) as string, | ||
); | ||
const info = await redisClient.getInfo(true, 'server'); |
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.
server
* @param infoSection - e.g. server, clients, memory, etc. | ||
*/ | ||
public async getInfo(force = false): Promise<object> { | ||
public async getInfo(force = true, infoSection?: string) { |
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.
let's remove infoSection
this.info = { | ||
...this.info, | ||
...infoData, | ||
} |
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.
let's replace this with entirely new object we've got
replyEncoding: 'utf8', | ||
}) as string, | ||
); | ||
const info = await client.getInfo(true, 'keyspace'); |
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.
keyspace here
…led via ACL (#4390) * RI-6848: add info_command_is_disabled to analytics when INFO is disabled via ACL * add isInfoCommandDisabled prop to RedisClient * preserve function signature * set default value for isInfoCommandDisabled * refactor getInfo * update: always call HELLO if INFO fails
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.
Tested and it looks OK. 🚀
Side note: I know that we merged few branches to this one, so this makes the whole change list bigger and it's hard to follow all the changes (big PR well known problem). I don't have perfect solution, but I'd rather prefer to merge them to main, than to a single branch that is merged back to main. (a.k.a. dont merge 3 > 2 > 1, but 1 to main, 2 to main and 3 to main). This way it's easier for me to see what happened.
Of course, the above is debatable, just saw it here and wanted to bring it up.
As long as 1,2,3 are individually mergable, yes! But if they don't make sense to be tested separately ... |
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.
lgtm
Description
Notes
Updates
getInfo
in redis.client.ts)