提交 03782af5 编写于 作者: D dontknow9179 提交者: ob-robot

placeholder for new privilege system view in mysql mode

上级 4e4edf18
......@@ -502,6 +502,7 @@ typedef enum ObItemType
T_FUN_SYS_AUDIT_LOG_SET_USER = 771,
T_FUN_SYS_AUDIT_LOG_REMOVE_USER = 772,
T_FUN_SYS_PASSWORD = 773,
T_FUN_SYS_IS_ENABLED_ROLE = 774,
///< @note add new mysql only function type before this line
T_MYSQL_ONLY_SYS_MAX_OP = 800,
......
......@@ -4159,6 +4159,36 @@ int ObInnerTableSchema::all_table_privilege_schema(ObTableSchema &table_schema)
priv_others_default,
priv_others_default); //default_value
}
if (OB_SUCC(ret)) {
ADD_COLUMN_SCHEMA("grantor", //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)) {
ADD_COLUMN_SCHEMA("grantor_host", //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_HOST_NAME_LENGTH, //column_length
-1, //column_precision
-1, //column_scale
true, //is_nullable
false); //is_autoincrement
}
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);
......@@ -4569,6 +4599,36 @@ int ObInnerTableSchema::all_table_privilege_history_schema(ObTableSchema &table_
priv_others_default,
priv_others_default); //default_value
}
if (OB_SUCC(ret)) {
ADD_COLUMN_SCHEMA("grantor", //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)) {
ADD_COLUMN_SCHEMA("grantor_host", //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_HOST_NAME_LENGTH, //column_length
-1, //column_precision
-1, //column_scale
true, //is_nullable
false); //is_autoincrement
}
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);
......
......@@ -3695,6 +3695,36 @@ int ObInnerTableSchema::all_virtual_table_privilege_schema(ObTableSchema &table_
priv_others_default,
priv_others_default); //default_value
}
if (OB_SUCC(ret)) {
ADD_COLUMN_SCHEMA("grantor", //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)) {
ADD_COLUMN_SCHEMA("grantor_host", //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_HOST_NAME_LENGTH, //column_length
-1, //column_precision
-1, //column_scale
true, //is_nullable
false); //is_autoincrement
}
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);
......@@ -4089,6 +4119,36 @@ int ObInnerTableSchema::all_virtual_table_privilege_history_schema(ObTableSchema
priv_others_default,
priv_others_default); //default_value
}
if (OB_SUCC(ret)) {
ADD_COLUMN_SCHEMA("grantor", //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)) {
ADD_COLUMN_SCHEMA("grantor_host", //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_HOST_NAME_LENGTH, //column_length
-1, //column_precision
-1, //column_scale
true, //is_nullable
false); //is_autoincrement
}
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);
......
......@@ -11844,6 +11844,36 @@ int ObInnerTableSchema::all_virtual_routine_privilege_schema(ObTableSchema &tabl
all_priv_default,
all_priv_default); //default_value
}
if (OB_SUCC(ret)) {
ADD_COLUMN_SCHEMA("grantor", //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)) {
ADD_COLUMN_SCHEMA("grantor_host", //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_HOST_NAME_LENGTH, //column_length
-1, //column_precision
-1, //column_scale
true, //is_nullable
false); //is_autoincrement
}
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);
......@@ -12044,6 +12074,36 @@ int ObInnerTableSchema::all_virtual_routine_privilege_history_schema(ObTableSche
all_priv_default,
all_priv_default); //default_value
}
if (OB_SUCC(ret)) {
ADD_COLUMN_SCHEMA("grantor", //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)) {
ADD_COLUMN_SCHEMA("grantor_host", //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_HOST_NAME_LENGTH, //column_length
-1, //column_precision
-1, //column_scale
true, //is_nullable
false); //is_autoincrement
}
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);
......
......@@ -851,6 +851,36 @@ int ObInnerTableSchema::all_virtual_table_privilege_real_agent_ora_schema(ObTabl
false); //is_autoincrement
}
if (OB_SUCC(ret)) {
ADD_COLUMN_SCHEMA("GRANTOR", //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)) {
ADD_COLUMN_SCHEMA("GRANTOR_HOST", //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_HOST_NAME_LENGTH, //column_length
2, //column_precision
-1, //column_scale
true, //is_nullable
false); //is_autoincrement
}
if (OB_SUCC(ret)) {
ADD_COLUMN_SCHEMA("GMT_CREATE", //column_name
++column_id, //column_id
......
......@@ -11426,6 +11426,36 @@ int ObInnerTableSchema::all_routine_privilege_schema(ObTableSchema &table_schema
all_priv_default,
all_priv_default); //default_value
}
if (OB_SUCC(ret)) {
ADD_COLUMN_SCHEMA("grantor", //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)) {
ADD_COLUMN_SCHEMA("grantor_host", //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_HOST_NAME_LENGTH, //column_length
-1, //column_precision
-1, //column_scale
true, //is_nullable
false); //is_autoincrement
}
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);
......@@ -11642,6 +11672,36 @@ int ObInnerTableSchema::all_routine_privilege_history_schema(ObTableSchema &tabl
all_priv_default,
all_priv_default); //default_value
}
if (OB_SUCC(ret)) {
ADD_COLUMN_SCHEMA("grantor", //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)) {
ADD_COLUMN_SCHEMA("grantor_host", //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_HOST_NAME_LENGTH, //column_length
-1, //column_precision
-1, //column_scale
true, //is_nullable
false); //is_autoincrement
}
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);
......
......@@ -581,6 +581,8 @@ all_table_privilege_def = dict(
('priv_create_view', 'int', 'false', '0'),
('priv_show_view', 'int', 'false', '0'),
('priv_others', 'int', 'false', '0'),
('grantor', 'varchar:OB_MAX_USER_NAME_LENGTH_STORE', 'true'),
('grantor_host', 'varchar:OB_MAX_HOST_NAME_LENGTH', 'true'),
],
)
......@@ -6870,6 +6872,8 @@ all_routine_privilege_def = dict(
normal_columns = [
('all_priv', 'int', 'false', '0'),
('grantor', 'varchar:OB_MAX_USER_NAME_LENGTH_STORE', 'true'),
('grantor_host', 'varchar:OB_MAX_HOST_NAME_LENGTH', 'true'),
],
)
......@@ -34079,6 +34083,10 @@ def_table_schema(
""".replace("\n", " ")
)
# 21582: ROLE_TABLE_GRANTS
# 21583: ROLE_COLUMN_GRANTS
# 21584: ROLE_ROUTINE_GRANTS
#
# 余留位置(此行之前占位)
......@@ -4860,6 +4860,8 @@ int ObGrantArg::assign(const ObGrantArg &other)
object_id_ = other.object_id_;
grantor_id_ = other.grantor_id_;
is_inner_ = other.is_inner_;
grantor_ = other.grantor_;
grantor_host_ = other.grantor_host_;
if (OB_FAIL(ObDDLArg::assign(other))) {
SHARE_LOG(WARN, "fail to assign ddl arg", K(ret));
......@@ -4914,8 +4916,9 @@ OB_DEF_SERIALIZE(ObGrantArg)
remain_roles_,
is_inner_,
sel_col_ids_,
column_names_priv_
);
column_names_priv_,
grantor_,
grantor_host_);
return ret;
}
......@@ -4946,7 +4949,9 @@ OB_DEF_DESERIALIZE(ObGrantArg)
remain_roles_,
is_inner_,
sel_col_ids_,
column_names_priv_);
column_names_priv_,
grantor_,
grantor_host_);
//compatibility for old version
if (OB_SUCC(ret) && users_passwd_.count() > 0 && hosts_.empty()) {
......@@ -4987,7 +4992,9 @@ OB_DEF_SERIALIZE_SIZE(ObGrantArg)
remain_roles_,
is_inner_,
sel_col_ids_,
column_names_priv_);
column_names_priv_,
grantor_,
grantor_host_);
return len;
}
......@@ -5029,6 +5036,8 @@ int ObRevokeTableArg::assign(const ObRevokeTableArg &other)
obj_type_ = other.obj_type_;
grantor_id_ = other.grantor_id_;
revoke_all_ora_ = other.revoke_all_ora_;
grantor_ = other.grantor_;
grantor_host_ = other.grantor_host_;
if (OB_FAIL(ObDDLArg::assign(other))) {
LOG_WARN("fail to assign ddl arg", K(ret));
......@@ -5070,7 +5079,9 @@ OB_SERIALIZE_MEMBER((ObRevokeTableArg, ObDDLArg),
ins_col_ids_,
upd_col_ids_,
ref_col_ids_,
column_names_priv_);
column_names_priv_,
grantor_,
grantor_host_);
bool ObRevokeRoutineArg::is_valid() const
{
......@@ -5096,6 +5107,8 @@ int ObRevokeRoutineArg::assign(const ObRevokeRoutineArg& other)
obj_type_ = other.obj_type_;
grantor_id_ = other.grantor_id_;
revoke_all_ora_ = other.revoke_all_ora_;
grantor_ = other.grantor_;
grantor_host_ = other.grantor_host_;
}
return ret;
}
......@@ -5111,7 +5124,9 @@ OB_SERIALIZE_MEMBER((ObRevokeRoutineArg, ObDDLArg),
obj_type_,
grantor_id_,
obj_priv_array_,
revoke_all_ora_);
revoke_all_ora_,
grantor_,
grantor_host_);
bool ObRevokeSysPrivArg::is_valid() const
{
......
......@@ -5390,7 +5390,7 @@ public:
object_id_(common::OB_INVALID_ID), ins_col_ids_(),
upd_col_ids_(), ref_col_ids_(),
grantor_id_(common::OB_INVALID_ID), remain_roles_(), is_inner_(false),
sel_col_ids_(), column_names_priv_()
sel_col_ids_(), column_names_priv_(), grantor_(), grantor_host_()
{ }
virtual ~ObGrantArg() {}
bool is_valid() const;
......@@ -5401,7 +5401,8 @@ public:
TO_STRING_KV(K_(tenant_id), K_(priv_level), K_(db), K_(table), K_(priv_set),
K_(users_passwd), K_(hosts), K_(need_create_user), K_(has_create_user_priv),
K_(option), K_(object_type), K_(object_id), K_(grantor_id), K_(ins_col_ids),
K_(upd_col_ids), K_(ref_col_ids), K_(grantor_id), K_(column_names_priv));
K_(upd_col_ids), K_(ref_col_ids), K_(grantor_id), K_(column_names_priv),
K_(grantor), K_(grantor_host));
uint64_t tenant_id_;
share::schema::ObPrivLevel priv_level_;
......@@ -5428,6 +5429,8 @@ public:
bool is_inner_;
common::ObSEArray<uint64_t, 4> sel_col_ids_;
common::ObSEArray<std::pair<ObString, ObPrivType>, 4> column_names_priv_;
common::ObString grantor_;
common::ObString grantor_host_;
};
struct ObStandbyGrantArg : public ObDDLArg
......@@ -5501,7 +5504,8 @@ public:
priv_set_(0), grant_(true), obj_id_(common::OB_INVALID_ID),
obj_type_(common::OB_INVALID_ID), grantor_id_(common::OB_INVALID_ID),
obj_priv_array_(), revoke_all_ora_(false), sel_col_ids_(), ins_col_ids_(),
upd_col_ids_(), ref_col_ids_(), column_names_priv_()
upd_col_ids_(), ref_col_ids_(), column_names_priv_(),
grantor_(), grantor_host_()
{ }
int assign(const ObRevokeTableArg& other);
......@@ -5517,7 +5521,9 @@ public:
K_(obj_type),
K_(grantor_id),
K_(obj_priv_array),
K_(column_names_priv));
K_(column_names_priv),
K_(grantor),
K_(grantor_host));
uint64_t tenant_id_;
uint64_t user_id_;
......@@ -5535,6 +5541,8 @@ public:
common::ObSEArray<uint64_t, 4> upd_col_ids_;
common::ObSEArray<uint64_t, 4> ref_col_ids_;
common::ObSEArray<std::pair<ObString, ObPrivType>, 4> column_names_priv_;
common::ObString grantor_;
common::ObString grantor_host_;
private:
DISALLOW_COPY_AND_ASSIGN(ObRevokeTableArg);
};
......@@ -5547,7 +5555,7 @@ public:
ObRevokeRoutineArg() : ObDDLArg(), tenant_id_(common::OB_INVALID_ID), user_id_(common::OB_INVALID_ID),
priv_set_(0), grant_(true), obj_id_(common::OB_INVALID_ID),
obj_type_(common::OB_INVALID_ID), grantor_id_(common::OB_INVALID_ID),
obj_priv_array_(), revoke_all_ora_(false)
obj_priv_array_(), revoke_all_ora_(false), grantor_(), grantor_host_()
{ }
bool is_valid() const;
int assign(const ObRevokeRoutineArg &other);
......@@ -5560,7 +5568,9 @@ public:
K_(obj_id),
K_(obj_type),
K_(grantor_id),
K_(obj_priv_array));
K_(obj_priv_array),
K_(grantor),
K_(grantor_host));
uint64_t tenant_id_;
uint64_t user_id_;
......@@ -5573,6 +5583,8 @@ public:
uint64_t grantor_id_;
share::ObRawObjPrivArray obj_priv_array_;
bool revoke_all_ora_;
common::ObString grantor_;
common::ObString grantor_host_;
};
struct ObRevokeSysPrivArg : public ObDDLArg
......
......@@ -1163,6 +1163,7 @@ static ObExpr::EvalFunc g_expr_eval_functions[] = {
NULL, // ObExprLastRefreshScn::eval_last_refresh_scn /* 690 */
NULL, // ObExprDocLength::generate_doc_length, /*691*/
NULL, // ObExprTopNFilter::eval_topn_filter, /* 692 */
NULL, // ObExprIsEnabledRole::eval_is_enabled_role, /* 693 */
};
static ObExpr::EvalBatchFunc g_expr_eval_batch_functions[] = {
......
......@@ -2491,6 +2491,8 @@ priv_index bigint(20) NO 0
priv_create_view bigint(20) NO 0
priv_show_view bigint(20) NO 0
priv_others bigint(20) NO 0
grantor varchar(128) YES NULL
grantor_host varchar(128) YES NULL
select /*+QUERY_TIMEOUT(60000000)*/ IF(count(*) >= 0, 1, 0) from oceanbase.__all_virtual_table_privilege;
IF(count(*) >= 0, 1, 0)
1
......@@ -2516,6 +2518,8 @@ priv_index bigint(20) YES 0
priv_create_view bigint(20) YES 0
priv_show_view bigint(20) YES 0
priv_others bigint(20) YES 0
grantor varchar(128) YES NULL
grantor_host varchar(128) YES NULL
select /*+QUERY_TIMEOUT(60000000)*/ IF(count(*) >= 0, 1, 0) from oceanbase.__all_virtual_table_privilege_history;
IF(count(*) >= 0, 1, 0)
1
......@@ -9172,6 +9176,8 @@ routine_type bigint(20) NO PRI NULL
gmt_create timestamp(6) NO NULL
gmt_modified timestamp(6) NO NULL
all_priv bigint(20) NO 0
grantor varchar(128) YES NULL
grantor_host varchar(128) YES NULL
select /*+QUERY_TIMEOUT(60000000)*/ IF(count(*) >= 0, 1, 0) from oceanbase.__all_virtual_routine_privilege;
IF(count(*) >= 0, 1, 0)
1
......@@ -9187,6 +9193,8 @@ gmt_create timestamp(6) NO NULL
gmt_modified timestamp(6) NO NULL
is_deleted bigint(20) NO NULL
all_priv bigint(20) YES 0
grantor varchar(128) YES NULL
grantor_host varchar(128) YES NULL
select /*+QUERY_TIMEOUT(60000000)*/ IF(count(*) >= 0, 1, 0) from oceanbase.__all_virtual_routine_privilege_history;
IF(count(*) >= 0, 1, 0)
1
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册