-
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
add session tool to manage and analysis sessions #3696
Conversation
@CPWstatic this PR has been open for a long time, please take a look and give feedback. thanks~ |
|
||
{ | ||
if ("groupCount" == op) { | ||
auto map = std::unordered_map<std::string, int>(); |
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 don't use std::unordered_map<std::string, int> map
directly?
return Status::OK(); | ||
} | ||
|
||
static Status deleteSession(const char* path, const std::string user) { |
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 don't merge sessionsCount
and deleteSession
into one ?
The session could be manipulated via admin command. We support read sessions for now, i suggest you implement a |
@CPWstatic |
This PR has been opened for too long. It is addressing a valid problem, although I'm not sure whether this problem is still there after almost a year. I've rebased the PR to check the CI results. |
Given that the CI here run into errors and this issue has been opened for too long, I'm closing this PR fow now. It is welcomed for anyone to pick this up later, fix related issues, and reopen it. |
What type of PR is this?
What problem(s) does this PR solve?
Issue(s) number:
Description:
Metad OOM because some users have frequently created sessions and did not release those sessions.
Finally by more than 8000000 sessions were created. When I tried to restart cluster, metad OOM occured again.
I found that graphd/storaged called waitForMetadReady function of MetaClient to wait for Metad become be available,
Metad loaded all sessions to memory in waitForMetadReady function. Too many sessions caused metad OOM.
How do you solve it?
I develop a session tool to delete extra sessions in the way offline. It directly delete sessions from rocksdb data of all metad after cluster shutdown. It can delete all sessions and delete the sessions for the specified user. like this:
delete all sessions:
session_tool -path data/meta/nebula/0/data -operator delete (need execute it on every metad node)
delete all sessions of root user:
session_tool -path data/meta/nebula/0/data -operator delete -user root (need execute it on every metad node)
In addition it also counts the number of sessions in rocksdb of metad in real time, like this:
The total number of sessions in cluster:
session_tool -path data/meta/nebula/0/data -operator count
The number of sessions per user:
session_tool -path data/meta/nebula/0/data -operator groupCount
It can also show sessions info, like this:
Show N sessions:
session_tool -path data/meta/nebula/0/data -operator list -limit N
Show N sessions of user root:
session_tool -path data/meta/nebula/0/data -operator list -limit N -user root
Special notes for your reviewer, ex. impact of this fix, design document, etc:
Checklist:
Tests:
Affects:
Release notes:
Please confirm whether to be reflected in release notes and how to describe: