Skip to content

Commit

Permalink
Fix compile & change proto tag (#243)
Browse files Browse the repository at this point in the history
* fix compile

* change proto tag
  • Loading branch information
lgqss authored Jun 5, 2024
1 parent e6db030 commit a66c2e9
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 13 deletions.
4 changes: 2 additions & 2 deletions proto/meta.interface.proto
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,8 @@ message UserPrivilege {
optional bool use_read_index = 15; // 读是否走folloewr read use read idx
optional bool enable_plan_cache = 16; // 是否缓存执行计划
optional RangePartitionType request_range_partition_type = 17; // 访问的Range分区类型
optional uint32 acl = 18; //权限控制列表,bitmap
optional bool if_exist = 19;
optional uint32 acl = 20; //权限控制列表,bitmap
optional bool if_exist = 21;
};

//集群信息
Expand Down
3 changes: 3 additions & 0 deletions proto/optype.proto
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,7 @@ enum OpType {
OP_SPECIFY_SPLIT_KEYS = 199; // 指定RangePartition分区的预分裂Key
OP_CONVERT_PARTITION = 200;
OP_MODIFY_USER = 201; //改user
OP_CREATE_VIEW = 202; // 新建视图
OP_DROP_VIEW = 203; // 删除视图
OP_DROP_INVALID_PRIVILEGE = 204; // 删除不存在的数据库/表的权限
};
4 changes: 2 additions & 2 deletions proto/store.interface.proto
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ message StoreReq {
optional uint64 sql_sign = 28; // sql 签名
repeated RegionInfo multi_new_region_infos = 29;
optional ExtraReq extra_req = 30; // 非关键路径上的额外信息可以放在这里,避免该message过度膨胀
optional int64 sql_exec_timeout = 31;
optional int64 sql_exec_timeout = 33;
};

message RowValue {
Expand Down Expand Up @@ -236,7 +236,7 @@ message StoreRes {
repeated int64 ttl_timestamp = 24;
optional ExtraRes extra_res = 25; // 非关键路径上的额外信息可以放在这里,避免该message过度膨胀
optional BinlogQueryInfo binlog_info = 26; //存放binlog信息
optional int64 read_disk_size = 27;
optional int64 read_disk_size = 28;
};
message InitRegion {
required RegionInfo region_info = 1;
Expand Down
2 changes: 1 addition & 1 deletion src/common/schema_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1368,7 +1368,7 @@ void SchemaFactory::update_show_db(const DataBaseVec& db_infos) {
BAIDU_SCOPED_LOCK(_update_show_db_mutex);
_show_db_info.clear();
for (auto db_info : db_infos) {
DB_WARNING("update_show_db: %s.%s", db_info.namespace_name().c_str(), db_info.database().c_str())
DB_WARNING("update_show_db: %s.%s", db_info.namespace_name().c_str(), db_info.database().c_str());
if (db_info.namespace_name() == "INTERNAL" && db_info.database() == "baikaldb") {
//忽略INTERNAL.baikaldb
continue;
Expand Down
4 changes: 2 additions & 2 deletions src/expr/internal_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2646,15 +2646,15 @@ ExprValue hex(const std::vector<ExprValue>& input) {
res.str_val = ss.str();
} else {
num.cast_to(pb::STRING);
char * c = (char *)malloc(2 * num.str_val.size() + 1);
char* c = new char[2 * num.str_val.size() + 1];
int idx = 0;
for (char ch : num.str_val) {
sprintf(c + idx, "%02X", static_cast<uint8_t>(ch));
idx += 2;
}
c[2 * num.str_val.size()] = 0;
res.str_val = c;
delete c;
delete[] c;
}
std::transform(res.str_val.begin(), res.str_val.end(), res.str_val.begin(), ::toupper);
return res;
Expand Down
6 changes: 3 additions & 3 deletions src/protocol/show_helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4611,7 +4611,7 @@ bool ShowHelper::_show_grants(const SmartSocket& client, const std::vector<std::
std::string with_grant = "";
std::string priv_str = get_priv_str(user_privilege.acl(), parser::GLOBAL_ACLS, with_grant);
char msg[1024];
snprintf(msg, sizeof(msg), "GRANT %s ON '%s'@'%' TO %s%s",
snprintf(msg, sizeof(msg), "GRANT %s ON '%s'@'%%' TO %s%s",
priv_str.c_str(), priv_level.c_str(), username.c_str(), with_grant.c_str());
row.emplace_back(msg);
rows.emplace_back(row);
Expand All @@ -4623,7 +4623,7 @@ bool ShowHelper::_show_grants(const SmartSocket& client, const std::vector<std::
std::string with_grant = "";
std::string priv_str = get_priv_str(db.acl(), parser::DB_ACLS, with_grant);
char msg[1024];
snprintf(msg, sizeof(msg), "GRANT %s ON '%s'@'%' TO %s%s",
snprintf(msg, sizeof(msg), "GRANT %s ON '%s'@'%%' TO %s%s",
priv_str.c_str(), priv_level.c_str(), username.c_str(), with_grant.c_str());
row.emplace_back(msg);
rows.emplace_back(row);
Expand All @@ -4636,7 +4636,7 @@ bool ShowHelper::_show_grants(const SmartSocket& client, const std::vector<std::
std::string with_grant = "";
std::string priv_str = get_priv_str(table.acl(), parser::TABLE_ACLS, with_grant);
char msg[1024];
snprintf(msg, sizeof(msg), "GRANT %s ON '%s'@'%' TO %s%s",
snprintf(msg, sizeof(msg), "GRANT %s ON '%s'@'%%' TO %s%s",
priv_str.c_str(), priv_level.c_str(), username.c_str(), with_grant.c_str());
row.emplace_back(msg);
rows.emplace_back(row);
Expand Down
6 changes: 3 additions & 3 deletions test/test_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -425,9 +425,9 @@ TEST(BvarMap, bvarmap) {
uint64_t parent_sign = 2385825078143366794;
std::set<uint64_t> subquery_signs = {8394144613061275097, 8919421716185942419};
//bm << BvarMap(std::make_pair("abc", 1));
bm << BvarMap("abc", 1, 101, 101, 10, 1, 5, 3, 1, field_range_type, 1, parent_sign, subquery_signs);
bm << BvarMap("abc", 4, 102, 102, 20, 2, 6, 2, 1, field_range_type, 1, parent_sign, subquery_signs);
bm << BvarMap("bcd", 5, 103, 103, 30, 3, 7, 1, 1, field_range_type, 1, parent_sign, subquery_signs);
bm << BvarMap("abc", 1, 101, 101, 10, 1, 5, 3, 100, 1, field_range_type, 1, parent_sign, subquery_signs);
bm << BvarMap("abc", 4, 102, 102, 20, 2, 6, 2, 100, 1, field_range_type, 1, parent_sign, subquery_signs);
bm << BvarMap("bcd", 5, 103, 103, 30, 3, 7, 1, 100, 1, field_range_type, 1, parent_sign, subquery_signs);
std::cout << bm.get_value();
}

Expand Down

0 comments on commit a66c2e9

Please sign in to comment.