diff --git a/pkg/cnservice/upgrader/newAddTable.go b/pkg/cnservice/upgrader/newAddTable.go index ee1db5770e2d5..76846673704a2 100644 --- a/pkg/cnservice/upgrader/newAddTable.go +++ b/pkg/cnservice/upgrader/newAddTable.go @@ -119,4 +119,63 @@ var STATISTICSView = &table.Table{ "join `mo_catalog`.`mo_columns` `tcl` on (`idx`.`table_id` = `tcl`.`att_relname_id` and `idx`.`column_name` = `tcl`.`attname`)", } -var needUpgradNewView = []*table.Table{PARTITIONSView, STATISTICSView} +var processlistView = &table.Table{ + Account: table.AccountAll, + Database: sysview.InformationDBConst, + Table: "processlist", + Columns: []table.Column{ + table.StringColumn("account", "the account name"), + table.StringColumn("client_host", "the ip:port of the client"), + table.StringColumn("command", "the COMMAND send by client"), + table.UInt64Column("conn_id", "the connection id of the tcp between client"), + table.StringColumn("db", "the database be used"), + table.StringColumn("host", "the ip:port of the mo-server"), + table.StringColumn("info", "the sql"), + table.StringColumn("node_id", "the id of the cn"), + table.StringColumn("query_start", "the start time of the statement"), + table.StringColumn("query_type", "the kind of the statement. DQL,TCL,etc"), + table.StringColumn("role", "the role of the user"), + table.StringColumn("session_id", "the id of the session"), + table.StringColumn("session_start", "the start time of the session"), + table.StringColumn("sql_source_type", "where does the sql come from. internal,external, etc"), + table.StringColumn("statement_id", "the id of the statement"), + table.StringColumn("statement_type", "the type of the statement.Select,Delete,Insert,etc"), + table.StringColumn("txn_id", "the id of the transaction"), + table.StringColumn("user", "the user name"), + }, + CreateViewSql: "CREATE VIEW IF NOT EXISTS `information_schema`.`PROCESSLIST` AS SELECT * FROM PROCESSLIST() A;", + //actually drop view here + CreateTableSql: "drop view if exists `information_schema`.`PROCESSLIST`;", +} + +var MoSessionsView = &table.Table{ + Account: table.AccountAll, + Database: catalog.MO_CATALOG, + Table: "mo_sessions", + Columns: []table.Column{ + table.StringColumn("account", "the account name"), + table.StringColumn("client_host", "the ip:port of the client"), + table.StringColumn("command", "the COMMAND send by client"), + table.UInt64Column("conn_id", "the connection id of the tcp between client"), + table.StringColumn("db", "the database be used"), + table.StringColumn("host", "the ip:port of the mo-server"), + table.StringColumn("info", "the sql"), + table.StringColumn("node_id", "the id of the cn"), + table.StringColumn("query_start", "the start time of the statement"), + table.StringColumn("query_type", "the kind of the statement. DQL,TCL,etc"), + table.StringColumn("role", "the role of the user"), + table.StringColumn("session_id", "the id of the session"), + table.StringColumn("session_start", "the start time of the session"), + table.StringColumn("sql_source_type", "where does the sql come from. internal,external, etc"), + table.StringColumn("statement_id", "the id of the statement"), + table.StringColumn("statement_type", "the type of the statement.Select,Delete,Insert,etc"), + table.StringColumn("txn_id", "the id of the transaction"), + table.StringColumn("user", "the user name"), + }, + CreateViewSql: "CREATE VIEW IF NOT EXISTS `mo_catalog`.`mo_sessions` AS SELECT * FROM mo_sessions() AS mo_sessions_tmp;", + //actually drop view here + CreateTableSql: "drop view `mo_catalog`.`mo_sessions`;", +} + +var needUpgradNewView = []*table.Table{PARTITIONSView, STATISTICSView, MoSessionsView} +var registeredViews = []*table.Table{processlistView} diff --git a/pkg/cnservice/upgrader/upgrader.go b/pkg/cnservice/upgrader/upgrader.go index 72353c803b6f7..5edf6ed9223e7 100644 --- a/pkg/cnservice/upgrader/upgrader.go +++ b/pkg/cnservice/upgrader/upgrader.go @@ -56,6 +56,8 @@ func ParseDataTypeToColType(dataType string) (table.ColType, error) { return table.TBytes, nil case strings.Contains(strings.ToLower(dataType), "uuid"): return table.TUuid, nil + case strings.Contains(strings.ToLower(dataType), "int unsigned"): + return table.TUint64, nil default: return table.TSkip, moerr.NewInternalError(context.Background(), "unknown data type") } @@ -185,6 +187,11 @@ func (u *Upgrader) Upgrade(ctx context.Context) error { return err } + if err = u.UpgradeNewViewColumn(ctx); err != nil { + logutil.Errorf("upgrade new view column failed: %s", err.Error()) + return err + } + if err = u.UpgradeNewTableColumn(ctx); err != nil { logutil.Errorf("upgrade new table column failed: %s", err.Error()) return err @@ -202,7 +209,46 @@ func (u *Upgrader) Upgrade(ctx context.Context) error { return nil } -// Upgrade the newly added columns in the system table +// UpgradeNewViewColumn the newly added columns in the system table +func (u *Upgrader) UpgradeNewViewColumn(ctx context.Context) error { + exec := u.IEFactory() + if exec == nil { + return nil + } + + for _, tbl := range registeredViews { + currentSchema, err := u.GetCurrentSchema(ctx, exec, tbl.Database, tbl.Table) + if err != nil { + return err + } + + diff, err := u.GenerateDiff(currentSchema, tbl) + if err != nil { + return err + } else if len(diff.AddedColumns) == 0 { + continue + } + + // + stmt := []string{ + "begin;", + appendSemicolon(tbl.CreateTableSql), //drop view + appendSemicolon(tbl.CreateViewSql), //create view + "commit;", + } + + //alter view + upgradeSQL := strings.Join(stmt, "\n") + + // Execute upgrade SQL + if err = exec.Exec(ctx, upgradeSQL, ie.NewOptsBuilder().Finish()); err != nil { + return err + } + } + return nil +} + +// UpgradeNewTableColumn the newly added columns in the system table func (u *Upgrader) UpgradeNewTableColumn(ctx context.Context) error { exec := u.IEFactory() if exec == nil { @@ -235,7 +281,7 @@ func (u *Upgrader) UpgradeNewTableColumn(ctx context.Context) error { return nil } -// Upgrade system tables, add system tables +// UpgradeNewTable system tables, add system tables func (u *Upgrader) UpgradeNewTable(ctx context.Context, tenants []*frontend.TenantInfo) error { exec := u.IEFactory() if exec == nil { @@ -266,7 +312,7 @@ func (u *Upgrader) UpgradeNewTable(ctx context.Context, tenants []*frontend.Tena return nil } -// Upgrade system tables, add system views +// UpgradeNewView system tables, add system views func (u *Upgrader) UpgradeNewView(ctx context.Context, tenants []*frontend.TenantInfo) error { exec := u.IEFactory() if exec == nil { @@ -421,3 +467,10 @@ func attachAccount(ctx context.Context, tenant *frontend.TenantInfo) context.Con func makeOptions(tenant *frontend.TenantInfo) *ie.OptsBuilder { return ie.NewOptsBuilder().AccountId(tenant.GetTenantID()).UserId(tenant.GetUserID()).DefaultRoleId(tenant.GetDefaultRoleID()) } + +func appendSemicolon(s string) string { + if !strings.HasSuffix(s, ";") { + return s + ";" + } + return s +} diff --git a/pkg/frontend/authenticate.go b/pkg/frontend/authenticate.go index c704baf086cce..c60ee31a1b7b1 100644 --- a/pkg/frontend/authenticate.go +++ b/pkg/frontend/authenticate.go @@ -816,6 +816,7 @@ var ( "mo_mysql_compatibility_mode": 0, "mo_stages": 0, catalog.MOAutoIncrTable: 0, + "mo_sessions": 0, } configInitVariables = map[string]int8{ "save_query_result": 0, @@ -842,6 +843,7 @@ var ( "mo_table_partitions": 0, "mo_pubs": 0, "mo_stages": 0, + "mo_sessions": 0, } createDbInformationSchemaSql = "create database information_schema;" createAutoTableSql = fmt.Sprintf(`create table if not exists %s ( @@ -1016,6 +1018,7 @@ var ( comment text, primary key(stage_id) );`, + `CREATE VIEW IF NOT EXISTS mo_sessions AS SELECT * FROM mo_sessions() AS mo_sessions_tmp;`, } //drop tables for the tenant @@ -1029,6 +1032,7 @@ var ( `drop table if exists mo_catalog.mo_stored_procedure;`, `drop table if exists mo_catalog.mo_mysql_compatibility_mode;`, `drop table if exists mo_catalog.mo_stages;`, + `drop view if exists mo_catalog.mo_sessions;`, } dropMoPubsSql = `drop table if exists mo_catalog.mo_pubs;` deleteMoPubsSql = `delete from mo_catalog.mo_pubs;` diff --git a/pkg/frontend/computation_wrapper.go b/pkg/frontend/computation_wrapper.go index 93fa3e20654df..0b9d4e63971a8 100644 --- a/pkg/frontend/computation_wrapper.go +++ b/pkg/frontend/computation_wrapper.go @@ -219,6 +219,7 @@ func (cwft *TxnComputationWrapper) Compile(requestCtx context.Context, u interfa // statement ID and updating snapshot TS. // See `func (exec *txnExecutor) Exec(sql string)` for details. txnOp := cwft.proc.TxnOperator + cwft.ses.SetTxnId(txnOp.Txn().ID) if txnOp != nil && !cwft.ses.IsDerivedStmt() { ok, _ := cwft.ses.GetTxnHandler().calledStartStmt() if !ok { diff --git a/pkg/frontend/mysql_cmd_executor.go b/pkg/frontend/mysql_cmd_executor.go index fee0bc8a646ba..34dbf6ef3a69a 100644 --- a/pkg/frontend/mysql_cmd_executor.go +++ b/pkg/frontend/mysql_cmd_executor.go @@ -222,7 +222,13 @@ var RecordStatement = func(ctx context.Context, ses *Session, proc *process.Proc stmID = uuid.New() text = SubStringFromBegin(envStmt, int(ses.GetParameterUnit().SV.LengthOfQueryPrinted)) } - ses.sqlType.Store(sqlType) + ses.SetStmtId(stmID) + ses.SetStmtType(getStatementType(statement).GetStatementType()) + ses.SetQueryType(getStatementType(statement).GetQueryType()) + ses.SetSqlSourceType(sqlType) + ses.SetSqlOfStmt(text) + + //note: txn id here may be empty if sqlType != constant.InternalSql { ses.pushQueryId(types.Uuid(stmID).ToString()) } @@ -336,7 +342,7 @@ var RecordStatementTxnID = func(ctx context.Context, ses *Session) { } else { stm.SetTxnID(txn.Txn().ID) } - + ses.SetTxnId(txn.Txn().ID) } stm.Report(ctx) } @@ -2544,6 +2550,8 @@ func (mce *MysqlCmdExecutor) executeStmt(requestCtx context.Context, var loadLocalErrGroup *errgroup.Group var loadLocalWriter *io.PipeWriter + ses.SetQueryStart(time.Now()) + // per statement profiler requestCtx, endStmtProfile := fileservice.NewStatementProfiler(requestCtx) if endStmtProfile != nil { diff --git a/pkg/frontend/mysql_cmd_executor_test.go b/pkg/frontend/mysql_cmd_executor_test.go index 9c39befa544e4..7ad91bf813760 100644 --- a/pkg/frontend/mysql_cmd_executor_test.go +++ b/pkg/frontend/mysql_cmd_executor_test.go @@ -316,6 +316,7 @@ func Test_mce_selfhandle(t *testing.T) { ).AnyTimes() txnOperator := mock_frontend.NewMockTxnOperator(ctrl) + txnOperator.EXPECT().Txn().Return(txn.TxnMeta{}).AnyTimes() txnOperator.EXPECT().Commit(ctx).Return(nil).AnyTimes() txnOperator.EXPECT().Rollback(ctx).Return(nil).AnyTimes() diff --git a/pkg/frontend/session.go b/pkg/frontend/session.go index 1195aeb8caa6b..a384c4dd55ab9 100644 --- a/pkg/frontend/session.go +++ b/pkg/frontend/session.go @@ -17,7 +17,6 @@ package frontend import ( "bytes" "context" - "encoding/hex" "fmt" "runtime" "strings" @@ -217,7 +216,6 @@ type Session struct { // requestLabel is the CN label info requested from client. requestLabel map[string]string - sqlType atomic.Value // startedAt is the session start time. startedAt time.Time @@ -230,6 +228,120 @@ type Session struct { // nextval internally will derive two sql (a select and an update). the two sql are executed // in the same transaction. derivedStmt bool + + //clear this part for every statement + stmtProfile struct { + // sqlSourceType denotes where the sql + sqlSourceType string + txnId uuid.UUID + stmtId uuid.UUID + // stmtType + stmtType string + // queryType + queryType string + // queryStart is the time when the query starts. + queryStart time.Time + //the sql from user may have multiple statements + //sqlOfStmt is the text part of one statement in the sql + sqlOfStmt string + } +} + +func (ses *Session) ClearStmtProfile() { + ses.mu.Lock() + defer ses.mu.Unlock() + ses.stmtProfile.sqlSourceType = "" + ses.stmtProfile.txnId = uuid.UUID{} + ses.stmtProfile.stmtId = uuid.UUID{} + ses.stmtProfile.stmtType = "" + ses.stmtProfile.queryType = "" + ses.stmtProfile.sqlOfStmt = "" +} + +func (ses *Session) GetSessionStart() time.Time { + ses.mu.Lock() + defer ses.mu.Unlock() + return ses.startedAt +} + +func (ses *Session) SetTxnId(id []byte) { + ses.mu.Lock() + defer ses.mu.Unlock() + copy(ses.stmtProfile.txnId[:], id) +} + +func (ses *Session) GetTxnId() uuid.UUID { + ses.mu.Lock() + defer ses.mu.Unlock() + return ses.stmtProfile.txnId +} + +func (ses *Session) SetStmtId(id uuid.UUID) { + ses.mu.Lock() + defer ses.mu.Unlock() + copy(ses.stmtProfile.stmtId[:], id[:]) +} + +func (ses *Session) GetStmtId() uuid.UUID { + ses.mu.Lock() + defer ses.mu.Unlock() + return ses.stmtProfile.stmtId +} + +func (ses *Session) SetStmtType(st string) { + ses.mu.Lock() + defer ses.mu.Unlock() + ses.stmtProfile.stmtType = st +} + +func (ses *Session) GetStmtType() string { + ses.mu.Lock() + defer ses.mu.Unlock() + return ses.stmtProfile.stmtType +} + +func (ses *Session) SetQueryType(qt string) { + ses.mu.Lock() + defer ses.mu.Unlock() + ses.stmtProfile.queryType = qt +} + +func (ses *Session) GetQueryType() string { + ses.mu.Lock() + defer ses.mu.Unlock() + return ses.stmtProfile.queryType +} + +func (ses *Session) SetSqlSourceType(st string) { + ses.stmtProfile.sqlSourceType = st +} + +func (ses *Session) GetSqlSourceType() string { + return ses.stmtProfile.sqlSourceType +} + +func (ses *Session) SetQueryStart(t time.Time) { + ses.mu.Lock() + defer ses.mu.Unlock() + ses.stmtProfile.queryStart = t +} + +func (ses *Session) GetQueryStart() time.Time { + ses.mu.Lock() + defer ses.mu.Unlock() + return ses.stmtProfile.queryStart +} + +func (ses *Session) SetSqlOfStmt(sot string) { + ses.mu.Lock() + defer ses.mu.Unlock() + ses.stmtProfile.sqlOfStmt = sot +} + +func (ses *Session) GetSqlOfStmt() string { + ses.mu.Lock() + defer ses.mu.Unlock() + return ses.stmtProfile.sqlOfStmt } func (ses *Session) IsDerivedStmt() bool { @@ -498,6 +610,7 @@ func (ses *Session) Close() { ses.seqCurValues = nil ses.seqLastValue = nil ses.sqlHelper = nil + ses.ClearStmtProfile() // The mpool cleanup must be placed at the end, // and you must wait for all resources to be cleaned up before you can delete the mpool if ses.proc != nil { @@ -2037,44 +2150,31 @@ func (ses *Session) SetNewResponse(category int, affectedRows uint64, cmd int, d // StatusSession implements the queryservice.Session interface. func (ses *Session) StatusSession() *status.Session { var ( - txnID string - statementID string - statementType string - queryType string - sqlSourceType string - queryStart time.Time + accountName string + userName string + roleName string ) - if ses.txnHandler != nil && ses.txnHandler.txnOperator != nil { - txn := ses.txnHandler.txnOperator.Txn() - txnID = hex.EncodeToString(txn.GetID()) - } - stmtInfo := ses.tStmt - if stmtInfo != nil { - statementID = uuid.UUID(stmtInfo.StatementID).String() - statementType = stmtInfo.StatementType - queryType = stmtInfo.QueryType - queryStart = stmtInfo.RequestAt - } - if v := ses.sqlType.Load(); v != nil { - sqlSourceType = v.(string) - } + + accountName, userName, roleName = getUserProfile(ses.GetTenantInfo()) return &status.Session{ NodeID: ses.getRoutineManager().baseService.ID(), ConnID: ses.GetConnectionID(), SessionID: ses.GetUUIDString(), - Account: ses.GetTenantName(), - User: ses.GetUserName(), + Account: accountName, + User: userName, Host: ses.getRoutineManager().baseService.SQLAddress(), DB: ses.GetDatabaseName(), - SessionStart: ses.startedAt, + SessionStart: ses.GetSessionStart(), Command: ses.GetCmd().String(), - Info: ses.GetSql(), - TxnID: txnID, - StatementID: statementID, - StatementType: statementType, - QueryType: queryType, - SQLSourceType: sqlSourceType, - QueryStart: queryStart, + Info: ses.GetSqlOfStmt(), + TxnID: ses.GetTxnId().String(), + StatementID: ses.GetStmtId().String(), + StatementType: ses.GetStmtType(), + QueryType: ses.GetQueryType(), + SQLSourceType: ses.GetSqlSourceType(), + QueryStart: ses.GetQueryStart(), + ClientHost: ses.GetMysqlProtocol().Peer(), + Role: roleName, } } diff --git a/pkg/frontend/session_test.go b/pkg/frontend/session_test.go index 066766f5ef969..51590510a79de 100644 --- a/pkg/frontend/session_test.go +++ b/pkg/frontend/session_test.go @@ -553,6 +553,7 @@ func TestSession_TxnCompilerContext(t *testing.T) { testutil.SetupAutoIncrService() ctx := context.TODO() txnOperator := mock_frontend.NewMockTxnOperator(ctrl) + txnOperator.EXPECT().Txn().Return(txn.TxnMeta{}).AnyTimes() txnOperator.EXPECT().Commit(ctx).Return(nil).AnyTimes() txnOperator.EXPECT().Rollback(ctx).Return(nil).AnyTimes() txnClient := mock_frontend.NewMockTxnClient(ctrl) diff --git a/pkg/frontend/txn.go b/pkg/frontend/txn.go index 2154438ef5926..7c59fd8abc5f3 100644 --- a/pkg/frontend/txn.go +++ b/pkg/frontend/txn.go @@ -226,6 +226,7 @@ func (th *TxnHandler) NewTxn() (context.Context, TxnOperator, error) { // txnOp.GetWorkspace().StartStatement() // th.enableStartStmt() //} + th.ses.SetTxnId(txnOp.Txn().ID) return txnCtx, txnOp, err } @@ -316,6 +317,7 @@ func (th *TxnHandler) CommitTxn() error { }() } if txnOp != nil { + th.ses.SetTxnId(txnOp.Txn().ID) err = txnOp.Commit(ctx2) if err != nil { txnId := txnOp.Txn().DebugString() @@ -376,6 +378,7 @@ func (th *TxnHandler) RollbackTxn() error { }() } if txnOp != nil { + th.ses.SetTxnId(txnOp.Txn().ID) err = txnOp.Rollback(ctx2) if err != nil { txnId := txnOp.Txn().DebugString() diff --git a/pkg/frontend/util.go b/pkg/frontend/util.go index bd8a30f89f9b8..0594ff2d72580 100644 --- a/pkg/frontend/util.go +++ b/pkg/frontend/util.go @@ -635,3 +635,23 @@ func copyBytes(src []byte, needCopy bool) []byte { } return src } + +// getUserProfile returns the account, user, role of the account +func getUserProfile(account *TenantInfo) (string, string, string) { + var ( + accountName string + userName string + roleName string + ) + + if account != nil { + accountName = account.GetTenant() + userName = account.GetUser() + roleName = account.GetDefaultRole() + } else { + accountName = sysAccountName + userName = rootName + roleName = moAdminRoleName + } + return accountName, userName, roleName +} diff --git a/pkg/pb/status/status.pb.go b/pkg/pb/status/status.pb.go index 1637eef98e171..1e32a39e6e55d 100644 --- a/pkg/pb/status/status.pb.go +++ b/pkg/pb/status/status.pb.go @@ -47,6 +47,8 @@ const ( SessionField_QUERY_TYPE SessionField = 13 SessionField_SQL_SOURCE_TYPE SessionField = 14 SessionField_QUERY_START SessionField = 15 + SessionField_CLIENT_HOST SessionField = 16 + SessionField_ROLE SessionField = 17 ) var SessionField_name = map[int32]string{ @@ -66,6 +68,8 @@ var SessionField_name = map[int32]string{ 13: "QUERY_TYPE", 14: "SQL_SOURCE_TYPE", 15: "QUERY_START", + 16: "CLIENT_HOST", + 17: "ROLE", } var SessionField_value = map[string]int32{ @@ -85,6 +89,8 @@ var SessionField_value = map[string]int32{ "QUERY_TYPE": 13, "SQL_SOURCE_TYPE": 14, "QUERY_START": 15, + "CLIENT_HOST": 16, + "ROLE": 17, } func (x SessionField) String() string { @@ -128,10 +134,14 @@ type Session struct { // SQLSourceType is the SQL source type: internal_sql, cloud_nonuser_sql, external_sql, cloud_user_sql. SQLSourceType string `protobuf:"bytes,15,opt,name=SQLSourceType,proto3" json:"SQLSourceType,omitempty"` // QueryStart is the start time of query. - QueryStart time.Time `protobuf:"bytes,16,opt,name=QueryStart,proto3,stdtime" json:"QueryStart"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + QueryStart time.Time `protobuf:"bytes,16,opt,name=QueryStart,proto3,stdtime" json:"QueryStart"` + // ClientHost is the ip:port of client. + ClientHost string `protobuf:"bytes,17,opt,name=ClientHost,proto3" json:"ClientHost,omitempty"` + // Role of the user + Role string `protobuf:"bytes,18,opt,name=Role,proto3" json:"Role,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Session) Reset() { *m = Session{} } @@ -279,6 +289,20 @@ func (m *Session) GetQueryStart() time.Time { return time.Time{} } +func (m *Session) GetClientHost() string { + if m != nil { + return m.ClientHost + } + return "" +} + +func (m *Session) GetRole() string { + if m != nil { + return m.Role + } + return "" +} + func init() { proto.RegisterEnum("status.SessionField", SessionField_name, SessionField_value) proto.RegisterType((*Session)(nil), "status.Session") @@ -287,42 +311,45 @@ func init() { func init() { proto.RegisterFile("status.proto", fileDescriptor_dfe4fce6682daf5b) } var fileDescriptor_dfe4fce6682daf5b = []byte{ - // 559 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x93, 0xcf, 0x6e, 0xd3, 0x40, - 0x10, 0xc6, 0xeb, 0x34, 0x75, 0x92, 0x71, 0xfe, 0x98, 0x05, 0xa1, 0x55, 0x85, 0xda, 0x08, 0x71, - 0xa8, 0x90, 0x88, 0x25, 0x38, 0x73, 0x48, 0x6c, 0x57, 0xb5, 0xd4, 0xda, 0xc4, 0xbb, 0x91, 0x28, - 0x97, 0xca, 0x49, 0xb7, 0xc6, 0xa2, 0xf6, 0x46, 0xf6, 0x5a, 0x6a, 0x1f, 0x81, 0x1b, 0x8f, 0xd5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x98, 0xda, 0x1d, - 0xdd, 0xf8, 0xec, 0x6c, 0x1a, 0x7a, 0x76, 0x57, 0x3a, 0x82, 0xf0, 0x38, 0xb2, 0x7b, 0x08, 0xc0, - 0xa4, 0x9f, 0x55, 0x7b, 0x40, 0x36, 0xf4, 0x09, 0x9d, 0x52, 0xff, 0xcc, 0x0f, 0xa9, 0x24, 0x16, - 0x42, 0x30, 0x7c, 0x24, 0xf4, 0xfc, 0x93, 0x6f, 0xf7, 0xe5, 0x50, 0xf3, 0x85, 0x1f, 0x9f, 0x6b, - 0x3d, 0x40, 0xcf, 0x61, 0x44, 0xe6, 0xa7, 0x17, 0x24, 0x5a, 0xc4, 0xae, 0xaf, 0xe1, 0x10, 0x8d, - 0xc0, 0xd2, 0x45, 0xfa, 0xf3, 0xa3, 0xd9, 0xc7, 0xbb, 0xfb, 0x03, 0xe3, 0xe7, 0xfd, 0x81, 0xf1, - 0xe7, 0xfe, 0xc0, 0xf8, 0xe2, 0x6c, 0xbd, 0xaf, 0x3c, 0x11, 0x65, 0x76, 0xc3, 0xcb, 0x2c, 0xcd, - 0x8a, 0x8d, 0x28, 0x98, 0xb3, 0xfe, 0x96, 0x3a, 0xeb, 0xa5, 0xa3, 0x1f, 0xe4, 0xd2, 0x54, 0xe7, - 0xfd, 0xf0, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x2a, 0xd7, 0xab, 0x78, 0xaf, 0x03, 0x00, 0x00, + // 598 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x93, 0xcd, 0x6a, 0xdb, 0x4a, + 0x14, 0xc7, 0x23, 0xc7, 0x91, 0xed, 0xe3, 0xaf, 0xc9, 0xb9, 0x97, 0xcb, 0x10, 0x2e, 0x8e, 0xb9, + 0xdc, 0x45, 0x28, 0xd4, 0x86, 0x76, 0xdd, 0x85, 0x2d, 0x29, 0x44, 0xe0, 0x48, 0xb5, 0x46, 0x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5a, 0xfe, 0x03, 0x00, 0x00, } func (m *Session) Marshal() (dAtA []byte, err error) { @@ -349,6 +376,24 @@ func (m *Session) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + if len(m.Role) > 0 { + i -= len(m.Role) + copy(dAtA[i:], m.Role) + i = encodeVarintStatus(dAtA, i, uint64(len(m.Role))) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x92 + } + if len(m.ClientHost) > 0 { + i -= len(m.ClientHost) + copy(dAtA[i:], m.ClientHost) + i = encodeVarintStatus(dAtA, i, uint64(len(m.ClientHost))) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x8a + } n1, err1 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.QueryStart, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.QueryStart):]) if err1 != nil { return 0, err1 @@ -542,6 +587,14 @@ func (m *Session) Size() (n int) { } l = github_com_gogo_protobuf_types.SizeOfStdTime(m.QueryStart) n += 2 + l + sovStatus(uint64(l)) + l = len(m.ClientHost) + if l > 0 { + n += 2 + l + sovStatus(uint64(l)) + } + l = len(m.Role) + if l > 0 { + n += 2 + l + sovStatus(uint64(l)) + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -1084,6 +1137,70 @@ func (m *Session) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 17: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClientHost", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStatus + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthStatus + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStatus + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClientHost = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 18: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Role", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStatus + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthStatus + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStatus + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Role = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipStatus(dAtA[iNdEx:]) diff --git a/pkg/sql/colexec/table_function/processlist.go b/pkg/sql/colexec/table_function/processlist.go index 7179a435865c8..9704081460dfe 100644 --- a/pkg/sql/colexec/table_function/processlist.go +++ b/pkg/sql/colexec/table_function/processlist.go @@ -140,6 +140,14 @@ func processlist(_ int, proc *process.Process, arg *Argument) (bool, error) { false, mp); err != nil { return false, err } + case status.SessionField_CLIENT_HOST: + if err := vector.AppendBytes(bat.Vecs[i], []byte(session.GetClientHost()), false, mp); err != nil { + return false, err + } + case status.SessionField_ROLE: + if err := vector.AppendBytes(bat.Vecs[i], []byte(session.GetRole()), false, mp); err != nil { + return false, err + } } } } diff --git a/pkg/sql/plan/query_builder.go b/pkg/sql/plan/query_builder.go index e1052baa2b69c..60f0e49e2e477 100644 --- a/pkg/sql/plan/query_builder.go +++ b/pkg/sql/plan/query_builder.go @@ -3316,7 +3316,7 @@ func (builder *QueryBuilder) buildTableFunction(tbl *tree.TableFunction, ctx *Bi nodeId, err = builder.buildCurrentAccount(tbl, ctx, exprs, childId) case "metadata_scan": nodeId = builder.buildMetadataScan(tbl, ctx, exprs, childId) - case "processlist": + case "processlist", "mo_sessions": nodeId, err = builder.buildProcesslist(tbl, ctx, exprs, childId) default: err = moerr.NewNotSupported(builder.GetContext(), "table function '%s' not supported", id) diff --git a/proto/status.proto b/proto/status.proto index 72fce63962cf8..41807d6613f15 100644 --- a/proto/status.proto +++ b/proto/status.proto @@ -38,6 +38,8 @@ enum SessionField { QUERY_TYPE = 13; SQL_SOURCE_TYPE = 14; QUERY_START = 15; + CLIENT_HOST = 16; + ROLE = 17; } // Session is the information of a session. @@ -76,4 +78,8 @@ message Session { // QueryStart is the start time of query. google.protobuf.Timestamp QueryStart = 16 [ (gogoproto.nullable) = false, (gogoproto.stdtime) = true ]; + // ClientHost is the ip:port of client. + string ClientHost = 17; + // Role of the user + string Role = 18; } \ No newline at end of file diff --git a/test/distributed/cases/dml/select/sp_table.result b/test/distributed/cases/dml/select/sp_table.result index a62771efee573..a8edc53672718 100644 --- a/test/distributed/cases/dml/select/sp_table.result +++ b/test/distributed/cases/dml/select/sp_table.result @@ -13,6 +13,7 @@ mo_pubs r mo_role r mo_role_grant r mo_role_privs r +mo_sessions v mo_stages r mo_stored_procedure r mo_table_partitions r diff --git a/test/distributed/cases/dml/show/database_statistics.result b/test/distributed/cases/dml/show/database_statistics.result index 3746ac821cb33..3d130555559c3 100644 --- a/test/distributed/cases/dml/show/database_statistics.result +++ b/test/distributed/cases/dml/show/database_statistics.result @@ -9,7 +9,7 @@ Number of tables in mysql 5 show table_number from mo_catalog; Number of tables in mo_catalog -16 +17 show table_number from system_metrics; Number of tables in system_metrics 20 @@ -35,7 +35,7 @@ Number of columns in profiling 18 show column_number from processlist; Number of columns in processlist -16 +18 show column_number from schemata; Number of columns in schemata 6 @@ -346,7 +346,7 @@ Number of tables in mysql 5 show table_number from mo_catalog; Number of tables in mo_catalog -15 +16 show table_number from system_metrics; Number of tables in system_metrics 7 @@ -365,7 +365,7 @@ Number of columns in profiling 18 show column_number from processlist; Number of columns in processlist -16 +18 show column_number from schemata; Number of columns in schemata 6 diff --git a/test/distributed/cases/dml/show/show.result b/test/distributed/cases/dml/show/show.result index 7cba5abc54392..34532ae84609d 100644 --- a/test/distributed/cases/dml/show/show.result +++ b/test/distributed/cases/dml/show/show.result @@ -231,6 +231,7 @@ mo_user_grant mo_role_grant mo_role_privs mo_user_defined_function +mo_sessions mo_stored_procedure mo_stages mo_mysql_compatibility_mode @@ -240,7 +241,7 @@ mo_columns mo_tables show table_number from mo_catalog; Number of tables in mo_catalog -16 +17 show column_number from mo_database; Number of columns in mo_database 9 diff --git a/test/distributed/cases/mo_cloud/mo_cloud.result b/test/distributed/cases/mo_cloud/mo_cloud.result index 63a611df10553..c6ff6a20b7f72 100644 --- a/test/distributed/cases/mo_cloud/mo_cloud.result +++ b/test/distributed/cases/mo_cloud/mo_cloud.result @@ -596,7 +596,7 @@ system_metrics 7 accountadmin information_schema 16 accountadmin mysql 5 accountadmin mo_mo 0 accountadmin -mo_catalog 15 - +mo_catalog 16 - SELECT mo_catalog.mo_database.datname,mo_catalog.mo_tables.relname,mo_catalog.mo_tables.relkind, if (role_name IS NULL,'-', role_name) AS `owner` FROM mo_catalog.mo_database LEFT JOIN mo_catalog.mo_tables ON mo_catalog.mo_database.datname = mo_catalog.mo_tables.reldatabase LEFT JOIN mo_catalog.mo_role ON mo_catalog.mo_tables.owner=role_id ORDER BY reldatabase, relname; datname relname relkind owner mo_mo null null - @@ -625,6 +625,7 @@ mo_catalog mo_pubs r accountadmin mo_catalog mo_role r accountadmin mo_catalog mo_role_grant r accountadmin mo_catalog mo_role_privs r accountadmin +mo_catalog mo_sessions v accountadmin mo_catalog mo_stages r accountadmin mo_catalog mo_stored_procedure r accountadmin mo_catalog mo_table_partitions r accountadmin diff --git a/test/distributed/cases/tenant/privilege/create_user_default_role.result b/test/distributed/cases/tenant/privilege/create_user_default_role.result index 5209a4ae53333..74af039628c94 100644 --- a/test/distributed/cases/tenant/privilege/create_user_default_role.result +++ b/test/distributed/cases/tenant/privilege/create_user_default_role.result @@ -37,6 +37,7 @@ mo_stages mo_tables mo_columns mo_database +mo_sessions create database t; internal error: do not have privilege to execute the statement grant create database on account * to r1; diff --git a/test/distributed/cases/tenant/tenant.result b/test/distributed/cases/tenant/tenant.result index f99d02033c80a..b7f9065566d4c 100644 --- a/test/distributed/cases/tenant/tenant.result +++ b/test/distributed/cases/tenant/tenant.result @@ -19,6 +19,7 @@ account_id relname relkind 0 mo_role r 0 mo_role_grant r 0 mo_role_privs r +0 mo_sessions v 0 mo_stages r 0 mo_stored_procedure r 0 mo_table_partitions r diff --git a/test/distributed/cases/zz_accesscontrol/create_account.result b/test/distributed/cases/zz_accesscontrol/create_account.result index fc28a67fe6fcc..be9ca2c2a676a 100644 --- a/test/distributed/cases/zz_accesscontrol/create_account.result +++ b/test/distributed/cases/zz_accesscontrol/create_account.result @@ -172,6 +172,7 @@ mo_stored_procedure mo_stages mo_database mo_columns +mo_sessions select user_name,authentication_string,owner from mo_user; user_name authentication_string owner admin *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 2