placeholder

This commit is contained in:
obdev 2024-02-21 14:15:34 +00:00 committed by ob-robot
parent 1a322a0a7c
commit 5b850564f4
24 changed files with 763 additions and 67 deletions

View File

@ -1124,6 +1124,8 @@ PCODE_DEF(OB_TRIM_KEY_LIST, 0x1618)
//PCODE_DEF(OB_ALTER_TRIGGER_WITH_RES, 0x161E)
//PCODE_DEF(OB_GAIS_BROADCAST_AUTO_INC_CACHE, 0x161F)
//proxy user
//PCODE_DEF(OB_ALTER_USER_PROXY, 0x1620)
//**** 注意:在此行之前增加新的RPC ID ******
//

View File

@ -2418,6 +2418,7 @@ typedef enum ObItemType
T_SHOW_PROCEDURE_CODE,
T_SHOW_FUNCTION_CODE,
T_CHANGE_EXTERNAL_STORAGE_DEST,
T_ALTER_USER_PROXY,
T_MAX //Attention: add a new type before T_MAX
} ObItemType;

View File

@ -1071,6 +1071,9 @@ int ObGvSqlAudit::fill_cells(obmysql::ObMySQLRequestRecord &record)
case TOTAL_SSSTORE_READ_ROW_COUNT: {
cells[cell_idx].set_int(record.data_.total_ssstore_read_row_count_);
} break;
case PROXY_USER_NAME: {
cells[cell_idx].set_null();
} break;
default: {
ret = OB_ERR_UNEXPECTED;
SERVER_LOG(WARN, "invalid column id", K(ret), K(cell_idx), K(col_id));

View File

@ -174,7 +174,8 @@ private:
STMT_TYPE,
SEQ_NUM,
TOTAL_MEMSTORE_READ_ROW_COUNT,
TOTAL_SSSTORE_READ_ROW_COUNT
TOTAL_SSSTORE_READ_ROW_COUNT,
PROXY_USER_NAME,
};
const static int64_t PRI_KEY_IP_IDX = 0;

View File

@ -448,6 +448,10 @@ bool ObShowProcesslist::FillScanner::operator()(sql::ObSQLSessionMgr::Key key, O
cur_row_->cells_[cell_idx].set_int(sess_info->get_client_addr_port());
break;
}
case PROXY_USER_NAME: {
cur_row_->cells_[cell_idx].set_null();
break;
}
default: {
ret = OB_ERR_UNEXPECTED;
SERVER_LOG(WARN, "invalid column id", K(ret), K(cell_idx),

View File

@ -78,7 +78,8 @@ private:
VPORT,
IN_BYTES,
OUT_BYTES,
USER_CLIENT_PORT
USER_CLIENT_PORT,
PROXY_USER_NAME,
};
class FillScanner
{

View File

@ -6597,10 +6597,14 @@ int ObDDLOperator::rename_user(
ret = OB_ERR_USER_NOT_EXIST;
LOG_WARN("User not exist", K(ret));
} else {
ObUserInfo new_user_info = *user_info;
new_user_info.set_user_name(new_account.user_name_);
new_user_info.set_host(new_account.host_name_);
if (OB_FAIL(schema_service_.gen_new_schema_version(tenant_id, new_schema_version))) {
ObUserInfo new_user_info;
if (OB_FAIL(new_user_info.assign(*user_info))) {
LOG_WARN("assign failed", K(ret));
} else if (OB_FAIL(new_user_info.set_user_name(new_account.user_name_))) {
LOG_WARN("set user name failed", K(ret));
} else if (OB_FAIL(new_user_info.set_host(new_account.host_name_))) {
LOG_WARN("set user host failed", K(ret));
} else if (OB_FAIL(schema_service_.gen_new_schema_version(tenant_id, new_schema_version))) {
LOG_WARN("fail to gen new schema_version", K(ret), K(tenant_id));
} else if (OB_FAIL(schema_sql_service->get_user_sql_service().rename_user(
new_user_info, new_schema_version, ddl_stmt_str, trans))) {
@ -6639,10 +6643,13 @@ int ObDDLOperator::set_passwd(
LOG_WARN("User not exist", K(ret));
} else {
int64_t new_schema_version = OB_INVALID_VERSION;
ObUserInfo new_user_info = *user_info;
new_user_info.set_passwd(passwd);
new_user_info.set_password_last_changed(ObTimeUtility::current_time());
if (OB_FAIL(schema_service_.gen_new_schema_version(tenant_id, new_schema_version))) {
ObUserInfo new_user_info;
if (OB_FAIL(new_user_info.assign(*user_info))) {
LOG_WARN("assign failed", K(ret));
} else if (OB_FAIL(new_user_info.set_passwd(passwd))) {
LOG_WARN("set passwd failed", K(ret));
} else if (OB_FALSE_IT(new_user_info.set_password_last_changed(ObTimeUtility::current_time()))) {
} else if (OB_FAIL(schema_service_.gen_new_schema_version(tenant_id, new_schema_version))) {
LOG_WARN("fail to gen new schema_version", K(ret), K(tenant_id));
} else if (OB_FAIL(schema_sql_service->get_user_sql_service().set_passwd(
new_user_info, new_schema_version, ddl_stmt_str, trans))) {
@ -6683,14 +6690,18 @@ int ObDDLOperator::set_max_connections(
LOG_WARN("User not exist", K(ret));
} else {
int64_t new_schema_version = OB_INVALID_VERSION;
ObUserInfo new_user_info = *user_info;
if (OB_INVALID_ID != max_connections_per_hour) {
ObUserInfo new_user_info;
if (OB_FAIL(new_user_info.assign(*user_info))) {
LOG_WARN("assign failed", K(ret));
}
if (OB_SUCC(ret) && OB_INVALID_ID != max_connections_per_hour) {
new_user_info.set_max_connections(max_connections_per_hour);
}
if (OB_INVALID_ID != max_user_connections) {
if (OB_SUCC(ret) && OB_INVALID_ID != max_user_connections) {
new_user_info.set_max_user_connections(max_user_connections);
}
if (OB_FAIL(schema_service_.gen_new_schema_version(tenant_id, new_schema_version))) {
if (OB_FAIL(ret)) {
} else if (OB_FAIL(schema_service_.gen_new_schema_version(tenant_id, new_schema_version))) {
LOG_WARN("fail to gen new schema_version", K(ret), K(tenant_id));
} else if (OB_FAIL(schema_sql_service->get_user_sql_service().set_max_connections(
new_user_info, new_schema_version, ddl_stmt_str, trans))) {
@ -6730,9 +6741,12 @@ int ObDDLOperator::alter_role(
LOG_WARN("Role not exist", K(ret));
} else {
int64_t new_schema_version = OB_INVALID_VERSION;
ObUserInfo new_role_info = *role_info;
new_role_info.set_passwd(passwd);
if (OB_FAIL(schema_service_.gen_new_schema_version(tenant_id, new_schema_version))) {
ObUserInfo new_role_info;
if (OB_FAIL(new_role_info.assign(*role_info))) {
LOG_WARN("assign failed", K(ret));
} else if (OB_FAIL(new_role_info.set_passwd(passwd))) {
LOG_WARN("set passwd failed", K(ret));
} else if (OB_FAIL(schema_service_.gen_new_schema_version(tenant_id, new_schema_version))) {
LOG_WARN("fail to gen new schema_version", K(ret), K(tenant_id));
} else if (OB_FAIL(schema_sql_service->get_user_sql_service().alter_role(
new_role_info, new_schema_version, ddl_stmt_str, trans))) {
@ -6833,12 +6847,17 @@ int ObDDLOperator::alter_user_require(const uint64_t tenant_id,
LOG_WARN("User not exist", K(ret));
} else {
int64_t new_schema_version = OB_INVALID_VERSION;
ObUserInfo new_user_info = *user_info;
new_user_info.set_ssl_type(arg.ssl_type_);
new_user_info.set_ssl_cipher(arg.ssl_cipher_);
new_user_info.set_x509_issuer(arg.x509_issuer_);
new_user_info.set_x509_subject(arg.x509_subject_);
if (OB_FAIL(schema_service_.gen_new_schema_version(tenant_id, new_schema_version))) {
ObUserInfo new_user_info;
if (OB_FAIL(new_user_info.assign(*user_info))) {
LOG_WARN("assign failed", K(ret));
} else {
new_user_info.set_ssl_type(arg.ssl_type_);
new_user_info.set_ssl_cipher(arg.ssl_cipher_);
new_user_info.set_x509_issuer(arg.x509_issuer_);
new_user_info.set_x509_subject(arg.x509_subject_);
}
if (OB_FAIL(ret)) {
} else if (OB_FAIL(schema_service_.gen_new_schema_version(tenant_id, new_schema_version))) {
LOG_WARN("fail to gen new schema_version", K(ret), K(tenant_id));
} else if (OB_FAIL(schema_sql_service->get_user_sql_service().alter_user_require(
new_user_info, new_schema_version, ddl_stmt_str, trans))) {
@ -6887,9 +6906,14 @@ int ObDDLOperator::grant_revoke_user(
}
//no matter privilege change or not, write a sql
int64_t new_schema_version = OB_INVALID_VERSION;
ObUserInfo new_user_info = *user_info;
new_user_info.set_priv_set(new_priv);
if (OB_FAIL(schema_service_.gen_new_schema_version(tenant_id, new_schema_version))) {
ObUserInfo new_user_info;
if (OB_FAIL(new_user_info.assign(*user_info))) {
LOG_WARN("assign failed", K(ret));
} else {
new_user_info.set_priv_set(new_priv);
}
if (OB_FAIL(ret)) {
} else if (OB_FAIL(schema_service_.gen_new_schema_version(tenant_id, new_schema_version))) {
LOG_WARN("fail to gen new schema_version", K(ret), K(tenant_id));
} else if (OB_FAIL(schema_sql_service->get_user_sql_service().grant_revoke_user(
new_user_info, new_schema_version, ddl_stmt_str, trans, is_from_inner_sql))) {
@ -6928,9 +6952,14 @@ int ObDDLOperator::lock_user(
LOG_WARN("User not exist", K(ret));
} else if (locked != user_info->get_is_locked()) {
int64_t new_schema_version = OB_INVALID_VERSION;
ObUserInfo new_user_info = *user_info;
new_user_info.set_is_locked(locked);
if (OB_FAIL(schema_service_.gen_new_schema_version(tenant_id, new_schema_version))) {
ObUserInfo new_user_info;
if (OB_FAIL(new_user_info.assign(*user_info))) {
LOG_WARN("assign failed", K(ret));
} else {
new_user_info.set_is_locked(locked);
}
if (OB_FAIL(ret)) {
} else if (OB_FAIL(schema_service_.gen_new_schema_version(tenant_id, new_schema_version))) {
LOG_WARN("fail to gen new schema_version", K(ret), K(tenant_id));
} else if (OB_FAIL(schema_sql_service->get_user_sql_service().lock_user(
new_user_info, new_schema_version, ddl_stmt_str, trans))) {

View File

@ -30680,9 +30680,11 @@ int ObDDLService::revoke(const ObRevokeUserArg &arg)
if (OB_SUCC(ret) && role_ids.count() > 0) {
ObDDLOperator ddl_operator(*schema_service_, *sql_proxy_);
ObDDLSQLTransaction trans(schema_service_);
ObUserInfo user = *user_info;
ObUserInfo user;
int64_t refreshed_schema_version = 0;
if (OB_FAIL(schema_guard.get_schema_version(tenant_id, refreshed_schema_version))) {
if (OB_FAIL(user.assign(*user_info))) {
LOG_WARN("assign user failed", K(ret), KPC(user_info));
} else if (OB_FAIL(schema_guard.get_schema_version(tenant_id, refreshed_schema_version))) {
LOG_WARN("failed to get tenant schema version", KR(ret), K(tenant_id));
} else if (OB_FAIL(trans.start(sql_proxy_, tenant_id, refreshed_schema_version))) {
LOG_WARN("Start transaction failed", KR(ret), K(tenant_id), K(refreshed_schema_version));
@ -31126,13 +31128,14 @@ int ObDDLService::alter_user_profile(const ObAlterUserProfileArg &arg)
}
if (OB_SUCC(ret) && OB_INVALID_ID == arg.default_role_flag_) {
ObUserInfo user_info = *user;
user_info.set_profile_id(profile_id);
ObUserInfo user_info;
ObDDLSQLTransaction trans(schema_service_);
ObDDLOperator ddl_operator(*schema_service_, *sql_proxy_);
int64_t refreshed_schema_version = 0;
if (OB_FAIL(schema_guard.get_schema_version(tenant_id, refreshed_schema_version))) {
if (OB_FAIL(user_info.assign(*user))) {
LOG_WARN("assign failed", K(ret));
} else if (OB_FALSE_IT(user_info.set_profile_id(profile_id))) {
} else if (OB_FAIL(schema_guard.get_schema_version(tenant_id, refreshed_schema_version))) {
LOG_WARN("failed to get tenant schema version", KR(ret), K(tenant_id));
} else if (OB_FAIL(trans.start(sql_proxy_, tenant_id, refreshed_schema_version))) {
LOG_WARN("start transaction failed", KR(ret), K(tenant_id), K(refreshed_schema_version));

View File

@ -2041,6 +2041,21 @@ int ObInnerTableSchema::all_virtual_processlist_schema(ObTableSchema &table_sche
user_client_port_default,
user_client_port_default); //default_value
}
if (OB_SUCC(ret)) {
ADD_COLUMN_SCHEMA("proxy_user", //column_name
++column_id, //column_id
0, //rowkey_id
0, //index_id
0, //part_key_pos
ObVarcharType, //column_type
CS_TYPE_INVALID, //column_collation_type
OB_MAX_USER_NAME_LENGTH_STORE, //column_length
-1, //column_precision
-1, //column_scale
true, //is_nullable
false); //is_autoincrement
}
if (OB_SUCC(ret)) {
table_schema.get_part_option().set_part_num(1);
table_schema.set_part_level(PARTITION_LEVEL_ONE);

View File

@ -875,6 +875,25 @@ int ObInnerTableSchema::all_user_schema(ObTableSchema &table_schema)
priv_others_default,
priv_others_default); //default_value
}
if (OB_SUCC(ret)) {
ObObj flags_default;
flags_default.set_int(0);
ADD_COLUMN_SCHEMA_T("flags", //column_name
++column_id, //column_id
0, //rowkey_id
0, //index_id
0, //part_key_pos
ObIntType, //column_type
CS_TYPE_INVALID, //column_collation_type
sizeof(int64_t), //column_length
-1, //column_precision
-1, //column_scale
false, //is_nullable
false, //is_autoincrement
flags_default,
flags_default); //default_value
}
table_schema.set_index_using_type(USING_BTREE);
table_schema.set_row_store_type(ENCODING_ROW_STORE);
table_schema.set_store_format(OB_STORE_FORMAT_DYNAMIC_MYSQL);
@ -1768,6 +1787,25 @@ int ObInnerTableSchema::all_user_history_schema(ObTableSchema &table_schema)
priv_others_default,
priv_others_default); //default_value
}
if (OB_SUCC(ret)) {
ObObj flags_default;
flags_default.set_int(0);
ADD_COLUMN_SCHEMA_T("flags", //column_name
++column_id, //column_id
0, //rowkey_id
0, //index_id
0, //part_key_pos
ObIntType, //column_type
CS_TYPE_INVALID, //column_collation_type
sizeof(int64_t), //column_length
-1, //column_precision
-1, //column_scale
true, //is_nullable
false, //is_autoincrement
flags_default,
flags_default); //default_value
}
table_schema.set_index_using_type(USING_BTREE);
table_schema.set_row_store_type(ENCODING_ROW_STORE);
table_schema.set_store_format(OB_STORE_FORMAT_DYNAMIC_MYSQL);

View File

@ -11179,6 +11179,21 @@ int ObInnerTableSchema::all_virtual_sql_audit_schema(ObTableSchema &table_schema
false, //is_nullable
false); //is_autoincrement
}
if (OB_SUCC(ret)) {
ADD_COLUMN_SCHEMA("proxy_user", //column_name
++column_id, //column_id
0, //rowkey_id
0, //index_id
0, //part_key_pos
ObVarcharType, //column_type
CS_TYPE_INVALID, //column_collation_type
OB_MAX_USER_NAME_LENGTH_STORE, //column_length
-1, //column_precision
-1, //column_scale
true, //is_nullable
false); //is_autoincrement
}
if (OB_SUCC(ret)) {
table_schema.get_part_option().set_part_num(1);
table_schema.set_part_level(PARTITION_LEVEL_ONE);
@ -13030,7 +13045,24 @@ int ObInnerTableSchema::all_virtual_sql_audit_all_virtual_sql_audit_i1_schema(Ob
true);//is_storing_column
}
table_schema.set_max_used_column_id(column_id + 105);
if (OB_SUCC(ret)) {
ADD_COLUMN_SCHEMA_WITH_COLUMN_FLAGS("proxy_user", //column_name
column_id + 106, //column_id
0, //rowkey_id
0, //index_id
0, //part_key_pos
ObVarcharType, //column_type
CS_TYPE_INVALID, //column_collation_type
OB_MAX_USER_NAME_LENGTH_STORE, //column_length
-1, //column_precision
-1, //column_scale
true,//is_nullable
false,//is_autoincrement
false,//is_hidden
true);//is_storing_column
}
table_schema.set_max_used_column_id(column_id + 106);
return ret;
}

View File

@ -15718,6 +15718,25 @@ int ObInnerTableSchema::all_virtual_user_schema(ObTableSchema &table_schema)
priv_others_default,
priv_others_default); //default_value
}
if (OB_SUCC(ret)) {
ObObj flags_default;
flags_default.set_int(0);
ADD_COLUMN_SCHEMA_T("flags", //column_name
++column_id, //column_id
0, //rowkey_id
0, //index_id
0, //part_key_pos
ObIntType, //column_type
CS_TYPE_INVALID, //column_collation_type
sizeof(int64_t), //column_length
-1, //column_precision
-1, //column_scale
false, //is_nullable
false, //is_autoincrement
flags_default,
flags_default); //default_value
}
table_schema.set_index_using_type(USING_BTREE);
table_schema.set_row_store_type(ENCODING_ROW_STORE);
table_schema.set_store_format(OB_STORE_FORMAT_DYNAMIC_MYSQL);
@ -16595,6 +16614,25 @@ int ObInnerTableSchema::all_virtual_user_history_schema(ObTableSchema &table_sch
priv_others_default,
priv_others_default); //default_value
}
if (OB_SUCC(ret)) {
ObObj flags_default;
flags_default.set_int(0);
ADD_COLUMN_SCHEMA_T("flags", //column_name
++column_id, //column_id
0, //rowkey_id
0, //index_id
0, //part_key_pos
ObIntType, //column_type
CS_TYPE_INVALID, //column_collation_type
sizeof(int64_t), //column_length
-1, //column_precision
-1, //column_scale
true, //is_nullable
false, //is_autoincrement
flags_default,
flags_default); //default_value
}
table_schema.set_index_using_type(USING_BTREE);
table_schema.set_row_store_type(ENCODING_ROW_STORE);
table_schema.set_store_format(OB_STORE_FORMAT_DYNAMIC_MYSQL);

View File

@ -1633,6 +1633,21 @@ int ObInnerTableSchema::all_virtual_sql_audit_ora_schema(ObTableSchema &table_sc
false, //is_nullable
false); //is_autoincrement
}
if (OB_SUCC(ret)) {
ADD_COLUMN_SCHEMA("PROXY_USER", //column_name
++column_id, //column_id
0, //rowkey_id
0, //index_id
0, //part_key_pos
ObVarcharType, //column_type
CS_TYPE_UTF8MB4_BIN, //column_collation_type
OB_MAX_USER_NAME_LENGTH_STORE, //column_length
2, //column_precision
-1, //column_scale
true, //is_nullable
false); //is_autoincrement
}
if (OB_SUCC(ret)) {
table_schema.get_part_option().set_part_num(1);
table_schema.set_part_level(PARTITION_LEVEL_ONE);
@ -3484,7 +3499,24 @@ int ObInnerTableSchema::all_virtual_sql_audit_ora_all_virtual_sql_audit_i1_schem
true);//is_storing_column
}
table_schema.set_max_used_column_id(column_id + 105);
if (OB_SUCC(ret)) {
ADD_COLUMN_SCHEMA_WITH_COLUMN_FLAGS("PROXY_USER", //column_name
column_id + 106, //column_id
0, //rowkey_id
0, //index_id
0, //part_key_pos
ObVarcharType, //column_type
CS_TYPE_UTF8MB4_BIN, //column_collation_type
OB_MAX_USER_NAME_LENGTH_STORE, //column_length
2, //column_precision
-1, //column_scale
true,//is_nullable
false,//is_autoincrement
false,//is_hidden
true);//is_storing_column
}
table_schema.set_max_used_column_id(column_id + 106);
return ret;
}
@ -8939,6 +8971,21 @@ int ObInnerTableSchema::all_virtual_processlist_ora_schema(ObTableSchema &table_
false, //is_nullable
false); //is_autoincrement
}
if (OB_SUCC(ret)) {
ADD_COLUMN_SCHEMA("PROXY_USER", //column_name
++column_id, //column_id
0, //rowkey_id
0, //index_id
0, //part_key_pos
ObVarcharType, //column_type
CS_TYPE_UTF8MB4_BIN, //column_collation_type
OB_MAX_USER_NAME_LENGTH_STORE, //column_length
2, //column_precision
-1, //column_scale
true, //is_nullable
false); //is_autoincrement
}
if (OB_SUCC(ret)) {
table_schema.get_part_option().set_part_num(1);
table_schema.set_part_level(PARTITION_LEVEL_ONE);

View File

@ -9599,6 +9599,21 @@ int ObInnerTableSchema::all_virtual_user_real_agent_ora_schema(ObTableSchema &ta
false); //is_autoincrement
}
if (OB_SUCC(ret)) {
ADD_COLUMN_SCHEMA("FLAGS", //column_name
++column_id, //column_id
0, //rowkey_id
0, //index_id
0, //part_key_pos
ObNumberType, //column_type
CS_TYPE_INVALID, //column_collation_type
38, //column_length
38, //column_precision
0, //column_scale
false, //is_nullable
false); //is_autoincrement
}
if (OB_SUCC(ret)) {
ADD_COLUMN_SCHEMA("GMT_CREATE", //column_name
++column_id, //column_id

View File

@ -454,6 +454,7 @@ all_user_def = dict(
('priv_drop_database_link', 'int', 'false', '0'),
('priv_create_database_link', 'int', 'false', '0'),
('priv_others', 'int', 'false', '0'),
('flags', 'int', 'false', '0'),
],
)
@ -6895,7 +6896,11 @@ def_table_schema(**all_tenant_snapshot_ls_replica_history_def)
# 509 : __all_ls_compaction_status
# 510 : __all_tablet_compaction_status
# 511 : __all_tablet_checksum_error_info
#
# 512 : __all_user_proxy_info
# 513 : __all_user_proxy_info_history
# 514 : __all_user_proxy_role_info
# 515 : __all_user_proxy_role_info_history
# 余留位置(此行之前占位)
# 本区域占位建议:采用真实表名进行占位
################################################################################
@ -7146,7 +7151,8 @@ def_table_schema(
('lb_vport', 'int', 'true'),
('in_bytes', 'bigint'),
('out_bytes', 'bigint'),
('user_client_port', 'int', 'false', '0')
('user_client_port', 'int', 'false', '0'),
('proxy_user', 'varchar:OB_MAX_USER_NAME_LENGTH_STORE', 'true'),
],
partition_columns = ['svr_ip', 'svr_port'],
vtable_route_policy = 'distributed',
@ -8205,7 +8211,8 @@ def_table_schema(
('stmt_type', 'varchar:MAX_STMT_TYPE_NAME_LENGTH', 'true'),
('seq_num', 'int'),
('total_memstore_read_row_count', 'int'),
('total_ssstore_read_row_count', 'int')
('total_ssstore_read_row_count', 'int'),
('proxy_user', 'varchar:OB_MAX_USER_NAME_LENGTH_STORE', 'true'),
],
partition_columns = ['svr_ip', 'svr_port'],
vtable_route_policy = 'distributed',
@ -13682,6 +13689,11 @@ def_table_schema(**gen_iterate_private_virtual_table_def(
# 12471: __all_virtual_tablet_compaction_status
# 12472: __all_virtual_tablet_checksum_error_info
# 12473: __all_virtual_compatibility_control
# 12474: __all_virtual_user_proxy_info
# 12475: __all_virtual_user_proxy_info_history
# 12476: __all_virtual_user_proxy_role_info
# 12477: __all_virtual_user_proxy_role_info_history
#
# 余留位置(此行之前占位)
# 本区域占位建议:采用真实表名进行占位
@ -14146,6 +14158,10 @@ def_table_schema(**no_direct_access(gen_oracle_mapping_real_virtual_table_def('1
# 15443: __all_virtual_ls_replica_task_history
# 15444: __all_virtual_session_ps_info
# 15445: __all_virtual_tracepoint_info
# 15446: __all_user_proxy_info
# 15447: __all_user_proxy_role_info
# 15448: idx_user_proxy_info_proxy_user_id_real_agent
#
# 余留位置(此行之前占位)
# 本区域定义的Oracle表名比较复杂,一般都采用gen_xxx_table_def()方式定义,占位建议采用基表表名占位
@ -51498,6 +51514,8 @@ def_table_schema(
""".replace("\n", " ")
)
#25301 PROXY_USERS
#
# 余留位置(此行之前占位)
# 本区域占位建议:采用真实视图名进行占位
@ -57795,7 +57813,7 @@ def_table_schema(
# 28220: V$OB_SESSION_PS_INFO
# 28221: GV$OB_TRACEPOINT_INFO
# 28222: V$OB_TRACEPOINT_INFO
#
# 余留位置(此行之前占位)
# 本区域占位建议:采用真实视图名进行占位
################################################################################
@ -58664,6 +58682,10 @@ def_sys_index_table(
# 101098: __all_transfer_partition_task
# 101099: __all_client_to_server_session_info
# 101100: __all_column_privilege
# 101101: __all_user_proxy_info
# 101102: __all_user_proxy_info_history
# 101103: __all_user_proxy_role_info_history
#
# 余留位置(此行之前占位)
# 索引表占位建议:基于基表(数据表)表名来占位,其他方式包括:索引名(index_name)、索引表表名

View File

@ -970,11 +970,8 @@ int ObPrivSqlService::grant_revoke_role(
} else if (NULL == role) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("role is null", K(ret), K(role_id));
} else {
const ObUserInfo role_info_tmp = *role;
if (OB_FAIL(role_infos.push_back(role_info_tmp))) {
LOG_WARN("fail to push back", K(ret), K(role_info_tmp));
}
} else if (OB_FAIL(role_infos.push_back(*role))) {
LOG_WARN("fail to push back", K(ret), KPC(role));
}
}
}

View File

@ -8434,6 +8434,159 @@ OB_SERIALIZE_MEMBER(ObPriv,
priv_set_,
priv_array_);
void ObProxyInfo::reset()
{
user_id_ = OB_INVALID_ID;
proxy_flags_ = 0;
credential_type_ = 0;
role_ids_ = NULL;
role_id_cnt_ = 0;
role_id_capacity_ = 0;
}
int ObProxyInfo::assign(const ObProxyInfo &other)
{
int ret = OB_SUCCESS;
if (this != &other) {
reset();
user_id_ = other.user_id_;
proxy_flags_ = other.proxy_flags_;
credential_type_ = other.credential_type_;
if (other.role_id_cnt_ != 0) {
if (OB_ISNULL(allocator_)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("unexpected error", K(ret));
} else {
uint64_t tmp_role_id_capacity = 0;
uint64_t tmp_role_id_cnt = 0;
uint64_t *tmp_role_ids = static_cast<uint64_t*>(allocator_->alloc(sizeof(uint64_t) * other.role_id_cnt_));
if (NULL == tmp_role_ids) {
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_ERROR("Fail to allocate memory for role_ids", K(ret));
} else {
MEMSET(tmp_role_ids, 0, sizeof(uint64_t) * other.role_id_cnt_);
tmp_role_id_capacity = other.role_id_cnt_;
for (int64_t i = 0; OB_SUCC(ret) && i < other.role_id_cnt_; ++i) {
uint64_t role_id = other.get_role_id_by_idx(i);
tmp_role_ids[tmp_role_id_cnt++] = role_id;
}
}
if (OB_SUCC(ret)) {
role_ids_ = tmp_role_ids;
role_id_capacity_ = tmp_role_id_capacity;
role_id_cnt_ = tmp_role_id_cnt;
}
}
}
}
return ret;
}
uint64_t ObProxyInfo::get_role_id_by_idx(const int64_t idx) const
{
uint64_t role_id = OB_INVALID_ID;
if (idx < 0 || idx >= role_id_cnt_) {
role_id = OB_INVALID_ID;
} else {
role_id = role_ids_[idx];
}
return role_id;
}
OB_DEF_SERIALIZE(ObProxyInfo)
{
int ret = OB_SUCCESS;
LST_DO_CODE(OB_UNIS_ENCODE,
user_id_,
proxy_flags_,
credential_type_);
if (OB_SUCC(ret)) {
LST_DO_CODE(OB_UNIS_ENCODE, role_id_cnt_);
for (int64_t i = 0; OB_SUCC(ret) && i < role_id_cnt_; ++i) {
LST_DO_CODE(OB_UNIS_ENCODE, role_ids_[i]);
}
}
return ret;
}
OB_DEF_DESERIALIZE(ObProxyInfo)
{
int ret = OB_SUCCESS;
LST_DO_CODE(OB_UNIS_DECODE,
user_id_,
proxy_flags_,
credential_type_);
if (OB_SUCC(ret)) {
OB_UNIS_DECODE(role_id_cnt_);
if (OB_SUCC(ret)) {
if (role_id_cnt_ == 0) {
role_ids_ = NULL;
role_id_capacity_ = 0;
} else {
role_ids_ = static_cast<uint64_t*>(allocator_->alloc(sizeof(uint64_t) * role_id_cnt_));
if (NULL == role_ids_) {
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_ERROR("Fail to allocate memory for role ids", K(ret));
} else {
MEMSET(role_ids_, 0, sizeof(uint64_t) * role_id_cnt_);
role_id_capacity_ = role_id_cnt_;
for (int64_t i = 0; OB_SUCC(ret) && i < role_id_cnt_; ++i) {
uint64_t role_id = OB_INVALID_ID;
LST_DO_CODE(OB_UNIS_DECODE, role_id);
role_ids_[i] = role_id;
}
}
}
}
}
return ret;
}
OB_DEF_SERIALIZE_SIZE(ObProxyInfo)
{
int64_t len = 0;
LST_DO_CODE(OB_UNIS_ADD_LEN,
user_id_,
proxy_flags_,
credential_type_,
role_id_cnt_);
len += role_id_cnt_ * sizeof(uint64_t);
return len;
}
int ObUserFlags::assign(const ObUserFlags &other)
{
int ret = OB_SUCCESS;
if (!other.is_valid()) {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("input ObUserFlags is invalid", K(ret), K(other));
} else {
flags_ = other.flags_;
}
return ret;
}
ObUserFlags& ObUserFlags::operator=(const ObUserFlags &other)
{
if (this != &other) {
flags_ = other.flags_;
}
return *this;
}
bool ObUserFlags::is_valid() const
{
bool bret = true;
if (OB_UNLIKELY(proxy_activated_flag_ < 0 || proxy_activated_flag_ >= PROXY_ACTIVATED_MAX)) {
bret = false;
}
return bret;
}
OB_SERIALIZE_MEMBER(ObUserFlags,flags_);
//ObUserInfo
ObUserInfo::ObUserInfo(ObIAllocator *allocator)
: ObSchema(allocator), ObPriv(allocator),
@ -8448,25 +8601,73 @@ ObUserInfo::ObUserInfo(ObIAllocator *allocator)
role_id_option_array_(common::OB_MALLOC_NORMAL_BLOCK_SIZE,
common::ModulePageAllocator(*allocator)),
max_connections_(0),
max_user_connections_(0)
max_user_connections_(0),
proxied_user_info_(NULL),
proxied_user_info_capacity_(0),
proxied_user_info_cnt_(0),
proxy_user_info_(NULL),
proxy_user_info_capacity_(0),
proxy_user_info_cnt_(0),
user_flags_()
{
}
ObUserInfo::ObUserInfo(const ObUserInfo &other)
: ObSchema(), ObPriv()
{
*this = other;
}
ObUserInfo::~ObUserInfo()
{
}
ObUserInfo& ObUserInfo::operator=(const ObUserInfo &other)
int ObUserInfo::assign_proxy_info_array_(ObProxyInfo **src_arr,
const uint64_t src_cnt,
const uint64_t src_capacity,
ObProxyInfo **&tar_arr,
uint64_t &tar_cnt,
uint64_t &tar_capacity)
{
int ret = OB_SUCCESS;
UNUSED(src_capacity);
ObProxyInfo **tmp_arr = NULL;
uint64_t tmp_cnt = 0;
uint64_t tmp_capacity = 0;
if (src_cnt == 0) {
//do nothing
} else if (NULL == (tmp_arr = static_cast<ObProxyInfo**>(
alloc(sizeof(ObProxyInfo*) * src_cnt)))) {
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_ERROR("Fail to allocate memory for array_.", K(src_cnt), KR(ret));
} else {
MEMSET(tmp_arr, 0, sizeof(ObProxyInfo*) * src_cnt);
tmp_capacity = src_cnt;
for (int64_t i = 0; OB_SUCC(ret) && i < src_cnt; i++) {
const ObProxyInfo *src_info = src_arr[i];
ObProxyInfo *tar_info = NULL;
if (OB_ISNULL(src_info)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("unexpected error", K(ret));
} else if (OB_ISNULL(tar_info = OB_NEWx(ObProxyInfo, get_allocator(), get_allocator()))) {
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_WARN("failed to allocate memory", K(ret), K(get_allocator()));
} else if (OB_FAIL(tar_info->assign(*src_info))) {
LOG_WARN("failed to assign proxy info", K(ret));
} else {
tmp_arr[tmp_cnt++] = tar_info;
}
}
if (OB_SUCC(ret)) {
tar_arr = tmp_arr;
tar_capacity = tmp_capacity;
tar_cnt = tmp_cnt;
}
}
return ret;
}
int ObUserInfo::assign(const ObUserInfo &other)
{
int ret = OB_SUCCESS;
if (this != &other) {
reset();
int ret = OB_SUCCESS;
error_ret_ = other.error_ret_;
ObPriv::operator=(other);
locked_ = other.locked_;
@ -8498,12 +8699,30 @@ ObUserInfo& ObUserInfo::operator=(const ObUserInfo &other)
password_last_changed_timestamp_ = other.password_last_changed_timestamp_;
max_connections_ = other.max_connections_;
max_user_connections_ = other.max_user_connections_;
if (OB_FAIL(assign_proxy_info_array_(other.proxied_user_info_,
other.proxied_user_info_cnt_,
other.proxied_user_info_capacity_,
proxied_user_info_,
proxied_user_info_cnt_,
proxied_user_info_capacity_))) {
LOG_WARN("assign proxy info array", K(ret));
} else if (OB_FAIL(assign_proxy_info_array_(other.proxy_user_info_,
other.proxy_user_info_cnt_,
other.proxy_user_info_capacity_,
proxy_user_info_,
proxy_user_info_cnt_,
proxy_user_info_capacity_))) {
LOG_WARN("assign proxy info array", K(ret));
}
if (OB_SUCC(ret)) {
user_flags_ = other.user_flags_;
}
}
if (OB_FAIL(ret)) {
error_ret_ = ret;
}
}
return *this;
return ret;
}
bool ObUserInfo::is_valid() const
@ -8529,6 +8748,13 @@ void ObUserInfo::reset()
password_last_changed_timestamp_ = OB_INVALID_TIMESTAMP;
max_connections_ = 0;
max_user_connections_ = 0;
proxied_user_info_ = NULL;
proxied_user_info_cnt_ = 0;
proxied_user_info_capacity_ = 0;
proxy_user_info_ = NULL;
proxy_user_info_cnt_ = 0;
proxy_user_info_capacity_ = 0;
user_flags_.reset();
ObSchema::reset();
ObPriv::reset();
}
@ -8548,6 +8774,18 @@ int64_t ObUserInfo::get_convert_size() const
convert_size += grantee_id_array_.get_data_size();
convert_size += role_id_array_.get_data_size();
convert_size += role_id_option_array_.get_data_size();
convert_size += proxied_user_info_cnt_ * sizeof(ObProxyInfo*);
convert_size += proxy_user_info_cnt_ * sizeof(ObProxyInfo*);
for (int64_t i = 0; i < proxied_user_info_cnt_; i++) {
if (OB_NOT_NULL(proxied_user_info_[i])) {
convert_size += proxied_user_info_[i]->get_convert_size();
}
}
for (int64_t i = 0; i < proxy_user_info_cnt_; i++) {
if (OB_NOT_NULL(proxy_user_info_[i])) {
convert_size += proxy_user_info_[i]->get_convert_size();
}
}
return convert_size;
}
@ -8573,6 +8811,68 @@ OB_DEF_SERIALIZE(ObUserInfo)
role_id_option_array_,
max_connections_,
max_user_connections_);
if (OB_SUCC(ret)) {
LST_DO_CODE(OB_UNIS_ENCODE, proxied_user_info_cnt_);
for (int64_t i = 0; OB_SUCC(ret) && i < proxied_user_info_cnt_; ++i) {
if (OB_ISNULL(proxied_user_info_[i])) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("unexpected null", K(ret));
} else {
LST_DO_CODE(OB_UNIS_ENCODE, *proxied_user_info_[i]);
}
}
}
if (OB_SUCC(ret)) {
LST_DO_CODE(OB_UNIS_ENCODE, proxy_user_info_cnt_);
for (int64_t i = 0; OB_SUCC(ret) && i < proxy_user_info_cnt_; ++i) {
if (OB_ISNULL(proxy_user_info_[i])) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("unexpected null", K(ret));
} else {
LST_DO_CODE(OB_UNIS_ENCODE, *proxy_user_info_[i]);
}
}
}
if (OB_SUCC(ret)) {
LST_DO_CODE(OB_UNIS_ENCODE, user_flags_);
}
return ret;
}
int ObUserInfo::deserialize_proxy_info_array_(ObProxyInfo **&arr, uint64_t &cnt, uint64_t &capacity,
const char *buf, const int64_t data_len, int64_t &pos)
{
int ret = OB_SUCCESS;
ObArenaAllocator tmp_allocator("ProxyInfo");
OB_UNIS_DECODE(cnt);
if (OB_FAIL(ret)) {
} else if (cnt == 0) {
capacity = 0;
arr = NULL;
} else if (NULL == (arr = static_cast<ObProxyInfo**>(
alloc(sizeof(ObProxyInfo*) * cnt)))) {
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_ERROR("Fail to allocate memory for array_.", KR(ret));
} else {
MEMSET(arr, 0, sizeof(ObProxyInfo*) * cnt);
for (int64_t i = 0; OB_SUCC(ret) && i < cnt; i++) {
ObProxyInfo proxy_info(&tmp_allocator);
LST_DO_CODE(OB_UNIS_DECODE, proxy_info);
if (OB_SUCC(ret)) {
ObProxyInfo *info = OB_NEWx(ObProxyInfo, get_allocator(), get_allocator());
if (NULL == info) {
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_WARN("failed to allocate memory", K(ret), K(get_allocator()));
} else if (OB_FAIL(info->assign(proxy_info))) {
LOG_WARN("failed to assign proxy info", K(ret));
} else {
arr[i] = info;
}
}
}
}
return ret;
}
@ -8625,6 +8925,19 @@ OB_DEF_DESERIALIZE(ObUserInfo)
role_id_option_array_,
max_connections_,
max_user_connections_);
if (OB_SUCC(ret)) {
if (OB_FAIL(deserialize_proxy_info_array_(proxied_user_info_, proxied_user_info_cnt_, proxied_user_info_capacity_,
buf, data_len, pos))) {
LOG_WARN("deserialize proxi info array failed", K(ret));
} else if (OB_FAIL(deserialize_proxy_info_array_(proxy_user_info_, proxy_user_info_cnt_, proxy_user_info_capacity_,
buf, data_len, pos))) {
LOG_WARN("deserialize proxi info array failed", K(ret));
}
}
if (OB_SUCC(ret)) {
LST_DO_CODE(OB_UNIS_DECODE, user_flags_);
}
}
return ret;
@ -8651,6 +8964,19 @@ OB_DEF_SERIALIZE_SIZE(ObUserInfo)
len += grantee_id_array_.get_serialize_size();
len += role_id_array_.get_serialize_size();
len += role_id_option_array_.get_serialize_size();
LST_DO_CODE(OB_UNIS_ADD_LEN, proxied_user_info_cnt_);
for (int64_t i = 0; i < proxied_user_info_cnt_; ++i) {
if (OB_NOT_NULL(proxied_user_info_[i])) {
LST_DO_CODE(OB_UNIS_ADD_LEN, *proxied_user_info_[i]);
}
}
LST_DO_CODE(OB_UNIS_ADD_LEN, proxy_user_info_cnt_);
for (int64_t i = 0; i < proxy_user_info_cnt_; ++i) {
if (OB_NOT_NULL(proxy_user_info_[i])) {
LST_DO_CODE(OB_UNIS_ADD_LEN, *proxy_user_info_[i]);
}
}
LST_DO_CODE(OB_UNIS_ADD_LEN, user_flags_);
return len;
}

View File

@ -4118,9 +4118,77 @@ enum ObUserType
OB_TYPE_MAX,
};
struct ObProxyInfo
{
OB_UNIS_VERSION(1);
private:
static const int64_t DEFAULT_ARRAY_CAPACITY = 8;
public:
ObProxyInfo(common::ObIAllocator *allocator) : allocator_(allocator), user_id_(OB_INVALID_ID), proxy_flags_(0),
credential_type_(0), role_ids_(NULL), role_id_cnt_(0), role_id_capacity_(0) {}
inline int64_t get_convert_size() const
{
int64_t convert_size = sizeof(*this);
convert_size += role_id_cnt_ * sizeof(uint64_t);
return convert_size;
}
void reset();
int assign(const ObProxyInfo &other);
uint64_t get_role_id_by_idx(const int64_t idx) const;
TO_STRING_KV(K_(user_id), K_(proxy_flags), K(ObArrayWrap<uint64_t>(role_ids_, role_id_cnt_)), K_(role_id_cnt));
common::ObIAllocator *allocator_;
uint64_t user_id_;
uint64_t proxy_flags_;
uint64_t credential_type_;
uint64_t *role_ids_;
uint64_t role_id_cnt_;
uint64_t role_id_capacity_;
};
#define ADMIN_OPTION_SHIFT 0
#define DISABLE_FLAG_SHIFT 1
enum ObProxyActivatedFlag
{
PROXY_NERVER_BEEN_ACTIVATED = 0,
PROXY_BEEN_ACTIVATED_BEFORE = 1,
PROXY_ACTIVATED_MAX,
};
//In user schema def, flag is a int column.
//int is int64_t, not uint64_t. So only 63 bit can be used.
struct ObUserFlags
{
OB_UNIS_VERSION_V(1);
private:
static const int32_t F_PROXY_INFO_OFFSET = 0;
static const int32_t F_PROXY_INFO_BITS = 1;
static const int32_t F_RESERVED = 63;
static const uint32_t F_PROXY_INFO_MASK = (((1L << F_PROXY_INFO_BITS) - 1) << F_PROXY_INFO_OFFSET);
public:
ObUserFlags() { reset(); }
virtual ~ObUserFlags() { reset(); }
void reset() { flags_ = 0; }
bool operator ==(const ObUserFlags &other) const
{
return flags_ == other.flags_;
}
int assign(const ObUserFlags &other);
ObUserFlags &operator=(const ObUserFlags &other);
bool is_valid() const;
TO_STRING_KV("proxy_activated_flag", proxy_activated_flag_);
union {
int64_t flags_;
struct {
uint64_t proxy_activated_flag_ :F_PROXY_INFO_BITS;
uint64_t reserved_ :F_RESERVED;
};
};
};
class ObUserInfo : public ObSchema, public ObPriv
{
OB_UNIS_VERSION(1);
@ -4133,12 +4201,13 @@ public:
type_(OB_USER), grantee_id_array_(), role_id_array_(), profile_id_(common::OB_INVALID_ID), password_last_changed_timestamp_(common::OB_INVALID_TIMESTAMP),
role_id_option_array_(),
max_connections_(0),
max_user_connections_(0)
max_user_connections_(0),
proxied_user_info_(NULL), proxied_user_info_capacity_(0), proxied_user_info_cnt_(0),
proxy_user_info_(NULL), proxy_user_info_capacity_(0), proxy_user_info_cnt_(0), user_flags_()
{ }
explicit ObUserInfo(common::ObIAllocator *allocator);
virtual ~ObUserInfo();
ObUserInfo(const ObUserInfo &other);
ObUserInfo& operator=(const ObUserInfo &other);
int assign(const ObUserInfo &other);
static bool cmp(const ObUserInfo *lhs, const ObUserInfo *rhs)
{ return (NULL != lhs && NULL != rhs) ? lhs->get_tenant_user_id() < rhs->get_tenant_user_id() : false; }
static bool equal(const ObUserInfo *lhs, const ObUserInfo *rhs)
@ -4215,11 +4284,25 @@ public:
K_(info), K_(locked),
K_(ssl_type), K_(ssl_cipher), K_(x509_issuer), K_(x509_subject),
K_(type), K_(grantee_id_array), K_(role_id_array),
K_(profile_id)
K_(profile_id), K_(proxied_user_info_cnt), K_(proxy_user_info_cnt),
"proxied info", ObArrayWrap<ObProxyInfo*>(proxied_user_info_, proxied_user_info_cnt_),
"proxy info", ObArrayWrap<ObProxyInfo*>(proxy_user_info_, proxy_user_info_cnt_),
K_(user_flags)
);
bool role_exists(const uint64_t role_id, const uint64_t option) const;
int get_seq_by_role_id(uint64_t role_id, uint64_t &seq) const;
private:
int assign_proxy_info_array_(ObProxyInfo **src_arr,
const uint64_t src_cnt,
const uint64_t src_capacity,
ObProxyInfo **&tar_arr,
uint64_t &tar_cnt,
uint64_t &tar_capacity);
int deserialize_proxy_info_array_(ObProxyInfo **&arr, uint64_t &cnt, uint64_t &capacity,
const char *buf, const int64_t data_len, int64_t &pos);
private:
static const int64_t DEFAULT_ARRAY_CAPACITY = 8;
common::ObString user_name_;
common::ObString host_name_;
common::ObString passwd_;
@ -4238,6 +4321,14 @@ private:
common::ObSEArray<uint64_t, 8> role_id_option_array_; // Record which roles the user/role has
uint64_t max_connections_;
uint64_t max_user_connections_;
ObProxyInfo** proxied_user_info_; //record users who can proxy the user
uint64_t proxied_user_info_capacity_;
uint64_t proxied_user_info_cnt_;
ObProxyInfo** proxy_user_info_; //recode users whom the user can proxy
uint64_t proxy_user_info_capacity_;
uint64_t proxy_user_info_cnt_;
ObUserFlags user_flags_;
DISABLE_COPY_ASSIGN(ObUserInfo);
};
struct ObDBPrivSortKey

View File

@ -172,11 +172,8 @@ int ObUserSqlService::drop_user_delete_role_grantee_map(
} else if (NULL == tmp_user) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("user info is null", K(ret), K(id));
} else {
const ObUserInfo user_info = *tmp_user;
if (OB_FAIL(user_infos.push_back(user_info))) {
LOG_WARN("fail to push back", K(ret), K(user_info));
}
} else if (OB_FAIL(user_infos.push_back(*tmp_user))) {
LOG_WARN("fail to push back", K(ret), KPC(tmp_user));
}
// generate delete sql stmt

View File

@ -295,12 +295,12 @@ OB_STMT_TYPE_DEF_UNKNOWN_AT(T_CANCEL_CLONE, get_sys_tenant_alter_system_priv, 29
OB_STMT_TYPE_DEF_UNKNOWN_AT(T_CREATE_MLOG, get_create_mlog_stmt_need_privs, 295)
OB_STMT_TYPE_DEF_UNKNOWN_AT(T_DROP_MLOG, get_drop_mlog_stmt_need_privs, 296)
OB_STMT_TYPE_DEF_UNKNOWN_AT(T_FLUSH_PRIVILEGES, no_priv_needed, 298)
// OB_STMT_TYPE_DEF_UNKNOWN_AT(T_TRANSFER_PARTITION, get_sys_tenant_alter_system_priv, 297)
// OB_STMT_TYPE_DEF_UNKNOWN_AT(T_ALTER_LS_REPLICA, get_sys_tenant_alter_system_priv, 299)
OB_STMT_TYPE_DEF_UNKNOWN_AT(T_SHOW_PROCEDURE_CODE, err_stmt_type_priv, 300)
OB_STMT_TYPE_DEF_UNKNOWN_AT(T_SHOW_FUNCTION_CODE, err_stmt_type_priv, 301)
OB_STMT_TYPE_DEF(T_CHANGE_EXTERNAL_STORAGE_DEST, no_priv_needed, 302, ACTION_TYPE_ALTER_SYSTEM)
OB_STMT_TYPE_DEF(T_ALTER_USER_PROXY, get_create_user_privs, 303, ACTION_TYPE_ALTER_USER)
OB_STMT_TYPE_DEF_UNKNOWN_AT(T_MAX, err_stmt_type_priv, 500)
#endif

View File

@ -73,6 +73,7 @@ ObBasicSessionInfo::ObBasicSessionInfo(const uint64_t tenant_id)
proxy_sessid_(VALID_PROXY_SESSID),
global_vars_version_(0),
sys_var_base_version_(OB_INVALID_VERSION),
proxy_user_id_(OB_INVALID_ID),
tx_desc_(NULL),
tx_result_(),
reserved_read_snapshot_version_(),
@ -459,6 +460,7 @@ void ObBasicSessionInfo::reset(bool skip_sys_var)
}
client_identifier_.reset();
last_refresh_schema_version_ = OB_INVALID_VERSION;
proxy_user_id_ = OB_INVALID_ID;
}
int ObBasicSessionInfo::reset_timezone()
@ -4453,6 +4455,12 @@ OB_DEF_SERIALIZE(ObBasicSessionInfo)
use_rich_vector_format_);
}();
OB_UNIS_ENCODE(ObString(sql_id_));
if (OB_SUCC(ret)) {
LST_DO_CODE(OB_UNIS_ENCODE,
proxy_user_id_,
thread_data_.proxy_user_name_,
thread_data_.proxy_host_name_);
}
return ret;
}
@ -4700,6 +4708,12 @@ OB_DEF_DESERIALIZE(ObBasicSessionInfo)
}();
ObString sql_id;
OB_UNIS_DECODE(sql_id);
if (OB_SUCC(ret)) {
LST_DO_CODE(OB_UNIS_DECODE,
proxy_user_id_,
thread_data_.proxy_user_name_,
thread_data_.proxy_host_name_);
}
return ret;
}
@ -4974,6 +4988,10 @@ OB_DEF_SERIALIZE_SIZE(ObBasicSessionInfo)
is_client_sessid_support_,
use_rich_vector_format_);
OB_UNIS_ADD_LEN(ObString(sql_id_));
LST_DO_CODE(OB_UNIS_ADD_LEN,
proxy_user_id_,
thread_data_.proxy_user_name_,
thread_data_.proxy_host_name_);
return len;
}

View File

@ -548,6 +548,7 @@ public:
bool is_query_killed() const;
bool is_valid() const { return is_valid_; };
uint64_t get_user_id() const { return user_id_; }
uint64_t get_proxy_user_id() const { return proxy_user_id_; }
bool is_auditor_user() const { return is_ora_auditor_user(user_id_); };
bool is_lbacsys_user() const { return is_ora_lbacsys_user(user_id_); };
bool is_oracle_sys_user() const { return is_ora_sys_user(user_id_); };
@ -744,6 +745,7 @@ public:
/// @{ thread_data_ related: }
int set_user(const common::ObString &user_name, const common::ObString &host_name, const uint64_t user_id);
inline void set_proxy_user_id(const uint64_t proxy_user_id) { proxy_user_id_ = proxy_user_id; }
int set_real_client_ip_and_port(const common::ObString &client_ip, int32_t client_addr_port);
const common::ObString &get_user_name() const { return thread_data_.user_name_;}
const common::ObString &get_host_name() const { return thread_data_.host_name_;}
@ -1485,7 +1487,9 @@ protected:
is_shadow_(false),
is_in_retry_(SESS_NOT_IN_RETRY),
client_addr_port_(0),
is_mark_killed_(false)
is_mark_killed_(false),
proxy_user_name_(),
proxy_host_name_()
{
CHAR_CARRAY_INIT(database_name_);
}
@ -1524,6 +1528,8 @@ protected:
is_in_retry_ = SESS_NOT_IN_RETRY;
client_addr_port_ = 0;
is_mark_killed_ = false;
proxy_user_name_.reset();
proxy_host_name_.reset();
}
~MultiThreadData ()
{
@ -1559,6 +1565,8 @@ protected:
ObSessionRetryStatus is_in_retry_;//标识当前session是否处于query retry的状态
int32_t client_addr_port_; // Record client address port.
bool is_mark_killed_; // Mark the current session as delayed kill
common::ObString proxy_user_name_;
common::ObString proxy_host_name_;
};
public:
@ -2118,6 +2126,7 @@ private:
uint64_t proxy_sessid_;
int64_t global_vars_version_; // used for obproxy synchronize variables
int64_t sys_var_base_version_;
uint64_t proxy_user_id_; // current proxy user id
/*******************************************
* transaction ctrl relative for session
*******************************************/

View File

@ -127,6 +127,7 @@ lb_vport bigint(20) YES NULL
in_bytes bigint(20) NO NULL
out_bytes bigint(20) NO NULL
user_client_port bigint(20) NO 0
proxy_user varchar(128) YES NULL
select /*+QUERY_TIMEOUT(60000000)*/ IF(count(*) >= 0, 1, 0) from oceanbase.__all_virtual_processlist;
IF(count(*) >= 0, 1, 0)
1
@ -787,6 +788,7 @@ stmt_type varchar(128) YES NULL
seq_num bigint(20) NO NULL
total_memstore_read_row_count bigint(20) NO NULL
total_ssstore_read_row_count bigint(20) NO NULL
proxy_user varchar(128) YES NULL
select /*+QUERY_TIMEOUT(60000000)*/ IF(count(*) >= 0, 1, 0) from oceanbase.__all_virtual_sql_audit;
IF(count(*) >= 0, 1, 0)
1
@ -1802,6 +1804,7 @@ priv_repl_client bigint(20) NO 0
priv_drop_database_link bigint(20) NO 0
priv_create_database_link bigint(20) NO 0
priv_others bigint(20) NO 0
flags bigint(20) NO 0
select /*+QUERY_TIMEOUT(60000000)*/ IF(count(*) >= 0, 1, 0) from oceanbase.__all_virtual_user;
IF(count(*) >= 0, 1, 0)
1

View File

@ -128,6 +128,7 @@ lb_vport bigint(20) YES NULL
in_bytes bigint(20) NO NULL
out_bytes bigint(20) NO NULL
user_client_port bigint(20) NO 0
proxy_user varchar(128) YES NULL
select /*+QUERY_TIMEOUT(60000000)*/ IF(count(*) >= 0, 1, 0) from oceanbase.__all_virtual_processlist;
IF(count(*) >= 0, 1, 0)
1
@ -860,6 +861,7 @@ stmt_type varchar(128) YES NULL
seq_num bigint(20) NO NULL
total_memstore_read_row_count bigint(20) NO NULL
total_ssstore_read_row_count bigint(20) NO NULL
proxy_user varchar(128) YES NULL
select /*+QUERY_TIMEOUT(60000000)*/ IF(count(*) >= 0, 1, 0) from oceanbase.__all_virtual_sql_audit;
IF(count(*) >= 0, 1, 0)
1
@ -3272,6 +3274,7 @@ priv_repl_client bigint(20) NO 0
priv_drop_database_link bigint(20) NO 0
priv_create_database_link bigint(20) NO 0
priv_others bigint(20) NO 0
flags bigint(20) NO 0
select /*+QUERY_TIMEOUT(60000000)*/ IF(count(*) >= 0, 1, 0) from oceanbase.__all_virtual_user;
IF(count(*) >= 0, 1, 0)
1
@ -3323,6 +3326,7 @@ priv_repl_client bigint(20) YES 0
priv_drop_database_link bigint(20) YES 0
priv_create_database_link bigint(20) YES 0
priv_others bigint(20) YES 0
flags bigint(20) YES 0
select /*+QUERY_TIMEOUT(60000000)*/ IF(count(*) >= 0, 1, 0) from oceanbase.__all_virtual_user_history;
IF(count(*) >= 0, 1, 0)
1