Skip to content

Commit

Permalink
合并 423 BP1最新代码
Browse files Browse the repository at this point in the history
  • Loading branch information
zhixin.lm committed Feb 5, 2024
1 parent a8e0752 commit 7ef4057
Show file tree
Hide file tree
Showing 65 changed files with 19,219 additions and 18,613 deletions.
12 changes: 6 additions & 6 deletions src/lib/ob_errno.h
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,7 @@ namespace common
static const int OB_ERR_SHARD_DDL_UNEXPECTED = -8204;
static const int OB_ERR_CAN_NOT_PASS_WHITELIST = -8205;

// obproxy common error code
// obproxy common error code
static const int OB_PROXY_INTERNAL_ERROR = -10001;
static const int OB_CLIENT_RECEIVING_PACKET_CONNECTION_ERROR = -10010;
static const int OB_CLIENT_HANDLING_REQUEST_CONNECTION_ERROR = -10011;
Expand Down Expand Up @@ -816,10 +816,10 @@ namespace common
static const int OB_PROXY_SHARD_HINT_NOT_SUPPORTED = -10304;
static const int OB_PROXY_SHARD_INVALID_CONFIG = -10305;

// kv related error code
// kv related error code


// proxy client related error code
// proxy client related error code


#define OB_SUCCESS__USER_ERROR_MSG "Success"
Expand Down Expand Up @@ -1523,7 +1523,7 @@ namespace common
#define OB_SERVER_IS_STOPPING__USER_ERROR_MSG "Server is stopping"
#define OB_PACKET_CHECKSUM_ERROR__USER_ERROR_MSG "Packet checksum error"

// obproxy common error code
// obproxy common error code
#define OB_PROXY_INTERNAL_ERROR__USER_ERROR_MSG "An internal error occured in obproxy"
#define OB_CLIENT_RECEIVING_PACKET_CONNECTION_ERROR__USER_ERROR_MSG "An unexpected connection event received from client while obproxy reading request"
#define OB_CLIENT_HANDLING_REQUEST_CONNECITON_ERROR__USER_ERROR_MSG "An unexpected connection event received from client while obproxy handling response"
Expand All @@ -1549,10 +1549,10 @@ namespace common
#define OB_PROXY_SHARD_HINT_NOT_SUPPORTED__USER_ERROR_MSG "ObProxy shard hint usage not supported"
#define OB_PROXY_SHARD_INVALID_CONFIG__USER_ERROR_MSG "ObProxy shard config is invalid"

// kv related error code
// kv related error code


// proxy client related error code
// proxy client related error code


const char* ob_strerror(int oberr);
Expand Down
37 changes: 13 additions & 24 deletions src/lib/oblog/ob_log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ void ObLogger::log_head_info(const ObLogFDType type,
if (FD_DIAGNOSIS_FILE == type) {
(void)logdata_printf(log_buffer.buffer_, MAX_LOG_SIZE, log_buffer.pos_,
"[%04d-%02d-%02d %02d:%02d:%02d.%06ld] "
"[%ld][" TRACE_ID_FORMAT "] [T] ",
"[%ld][" TRACE_ID_FORMAT "] ",
tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min,
tm.tm_sec, tv.tv_usec, GETTID(), trace_id_0, trace_id_1);
} else if (FD_XFLUSH_FILE == type) {
Expand All @@ -677,14 +677,14 @@ void ObLogger::log_head_info(const ObLogFDType type,
} else if (level < OB_LOG_LEVEL_INFO) {
(void)logdata_printf(log_buffer.buffer_, MAX_LOG_SIZE, log_buffer.pos_,
"[%04d-%02d-%02d %02d:%02d:%02d.%06ld] "
"%-5s %s%s (%s:%d) [%ld][" TRACE_ID_FORMAT "] [T] ",
"%-5s %s%s (%s:%d) [%ld][" TRACE_ID_FORMAT "] ",
tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min,
tm.tm_sec, tv.tv_usec, errstr_[level], mod_name, location.function_,
base_file_name, location.line_, GETTID(), trace_id_0, trace_id_1);
} else {
(void)logdata_printf(log_buffer.buffer_, MAX_LOG_SIZE, log_buffer.pos_,
"[%04d-%02d-%02d %02d:%02d:%02d.%06ld] "
"%-5s %s%s:%d [%ld][" TRACE_ID_FORMAT "] [T]",
"%-5s %s%s:%d [%ld][" TRACE_ID_FORMAT "] ",
tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min,
tm.tm_sec, tv.tv_usec, errstr_[level], mod_name, base_file_name,
location.line_, GETTID(), trace_id_0, trace_id_1);
Expand Down Expand Up @@ -759,10 +759,10 @@ void ObLogger::log_data(const ObLogFDType type,
if (FD_DIAGNOSIS_FILE == type) {
head_size = snprintf(head, MAX_LOG_HEAD_SIZE,
"[%04d-%02d-%02d %02d:%02d:%02d.%06ld] "
"[%ld][" TRACE_ID_FORMAT "] [T] ",
"[%ld][" TRACE_ID_FORMAT "] ",
tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min,
tm.tm_sec, tv.tv_usec, GETTID(), trace_id_0, trace_id_1);
} if (FD_XFLUSH_FILE == type) {
} else if (FD_XFLUSH_FILE == type) {
head_size = snprintf(head, MAX_LOG_HEAD_SIZE, "%04d-%02d-%02d %02d:%02d:%02d.%06ld [%s] ",
tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min,
tm.tm_sec, tv.tv_usec, errstr_[level]);
Expand Down Expand Up @@ -1753,25 +1753,14 @@ int ObLogger::async_log_data_header(const ObLogFDType type,
base_file_name = (NULL != base_file_name) ? base_file_name + 1 : file;
//[lt=%ld] last log cost time us
//[dc=%lu] async dropped log count
if (level < OB_LOG_LEVEL_INFO) {
ret = logdata_printf(data_buf, MAX_LOG_HEAD_SIZE, pos,
"[%04d-%02d-%02d %02d:%02d:%02d.%06ld] "
"%-5s %s%s (%s:%d) [%ld][" TRACE_ID_FORMAT "] [lt=%ld] [dc=%lu] ",
tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min,
tm.tm_sec, tv.tv_usec, errstr_[level], mod_name, function,
base_file_name, line, tid, trace_id_0, trace_id_1,
+last_logging_cost_time_us_,
dropped_log_count);
} else {
ret = logdata_printf(data_buf, MAX_LOG_HEAD_SIZE, pos,
"[%04d-%02d-%02d %02d:%02d:%02d.%06ld] "
"%-5s %s%s:%d [%ld][" TRACE_ID_FORMAT "] [lt=%ld] [dc=%lu] ",
tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min,
tm.tm_sec, tv.tv_usec, errstr_[level], mod_name, base_file_name,
line, tid, trace_id_0, trace_id_1,
+last_logging_cost_time_us_,
dropped_log_count);
}
ret = logdata_printf(data_buf, MAX_LOG_HEAD_SIZE, pos,
"[%04d-%02d-%02d %02d:%02d:%02d.%06ld] "
"%-5s %s%s (%s:%d) [%ld][" TRACE_ID_FORMAT "] [lt=%ld] [dc=%lu] ",
tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min,
tm.tm_sec, tv.tv_usec, errstr_[level], mod_name, function,
base_file_name, line, tid, trace_id_0, trace_id_1,
+last_logging_cost_time_us_,
dropped_log_count);
}
if (OB_SUCC(ret) || OB_UNLIKELY(OB_SIZE_OVERFLOW == ret)) {
ret = OB_SUCCESS;
Expand Down
2 changes: 1 addition & 1 deletion src/obproxy/cmd/ob_sequence_info_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ int ObSequenceInfoHandler::process_sequence_info(void* data)
snprintf(err_msg_, SEQUENCE_ERR_MSG_SIZE, "%.*s", tmp_seq_info->err_msg_.config_string_.length(),
tmp_seq_info->err_msg_.config_string_.ptr());
} else if (param_.need_value_ && !tmp_seq_info->is_valid()) {
LOG_INFO("is over need reschedule", K(*tmp_seq_info), K(retry_time_));
LOG_INFO("is over need reschedule", K(retry_time_));
op_free(tmp_seq_info);
tmp_seq_info = NULL;
if (retry_time_ < get_global_proxy_config().sequence_fail_retry_count) {
Expand Down
14 changes: 7 additions & 7 deletions src/obproxy/cmd/ob_show_create_table_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,25 @@ const ObProxyColumnSchema SHOW_CREATE_TABLE_ARRAY[OB_CT_SHARD_MAX_COLUMN_ID] = {
ObProxyColumnSchema::make_schema(OB_CT_CREATE_TABLE, "Create Table", OB_MYSQL_TYPE_LONG_BLOB),
};

ObShowCreateTableHandler::ObShowCreateTableHandler(ObMIOBuffer *buf, ObCmdInfo &info)
ObShardingShowCreateTableHandler::ObShardingShowCreateTableHandler(ObMIOBuffer *buf, ObCmdInfo &info)
: ObCmdHandler(buf, info)
{
}

int ObShowCreateTableHandler::show_create_table_cmd_callback(ObMIOBuffer *buf,
int ObShardingShowCreateTableHandler::show_create_table_cmd_callback(ObMIOBuffer *buf,
ObCmdInfo &info,
const ObString &logic_tenant_name,
const ObString &logic_database_name,
const ObString &logic_table_name)
{
int ret = OB_SUCCESS;
ObShowCreateTableHandler *handler = NULL;
ObShardingShowCreateTableHandler *handler = NULL;

if (OB_ISNULL(handler = new(std::nothrow) ObShowCreateTableHandler(buf, info))) {
if (OB_ISNULL(handler = new(std::nothrow) ObShardingShowCreateTableHandler(buf, info))) {
ret = OB_ALLOCATE_MEMORY_FAILED;
ERROR_CMD("fail to new ObShowCreateTableHandler", K(ret));
ERROR_CMD("fail to new ObShardingShowCreateTableHandler", K(ret));
} else if (OB_FAIL(handler->init())) {
WARN_CMD("fail to init for ObShowCreateTableHandler");
WARN_CMD("fail to init for ObShardingShowCreateTableHandler");
} else if (OB_FAIL(handler->handle_show_create_table(logic_tenant_name, logic_database_name, logic_table_name))){
WARN_CMD("fail to handle show create table", K(logic_tenant_name), K(logic_database_name),
K(logic_table_name), K(ret));
Expand All @@ -65,7 +65,7 @@ int ObShowCreateTableHandler::show_create_table_cmd_callback(ObMIOBuffer *buf,
return ret;
}

int ObShowCreateTableHandler::handle_show_create_table(const ObString &tenant_name,
int ObShardingShowCreateTableHandler::handle_show_create_table(const ObString &tenant_name,
const ObString &db_name,
const ObString &table_name)
{
Expand Down
8 changes: 4 additions & 4 deletions src/obproxy/cmd/ob_show_create_table_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ namespace obproxy
{
namespace obutils
{
class ObShowCreateTableHandler : public ObCmdHandler
class ObShardingShowCreateTableHandler : public ObCmdHandler
{
public:
ObShowCreateTableHandler(event::ObMIOBuffer *buf, ObCmdInfo &info);
virtual ~ObShowCreateTableHandler() {}
ObShardingShowCreateTableHandler(event::ObMIOBuffer *buf, ObCmdInfo &info);
virtual ~ObShardingShowCreateTableHandler() {}
int handle_show_create_table(const ObString &logic_tenant_name, const ObString &logic_database_name,
const ObString &logic_table_name);
static int show_create_table_cmd_callback(event::ObMIOBuffer *buf, ObCmdInfo &info,
const ObString &logic_tenant_name, const ObString &logic_database_name,
const ObString &logic_table_name);

DISALLOW_COPY_AND_ASSIGN(ObShowCreateTableHandler);
DISALLOW_COPY_AND_ASSIGN(ObShardingShowCreateTableHandler);
};
} // end of namespace obutils
} // end of namespace obproxy
Expand Down
20 changes: 10 additions & 10 deletions src/obproxy/cmd/ob_show_databases_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ enum
const static ObString &column_name = ObString::make_string("Database");
const static EMySQLFieldType column_type = OB_MYSQL_TYPE_VARCHAR;

ObShowDatabasesHandler::ObShowDatabasesHandler(ObMIOBuffer *buf, ObCmdInfo &info)
ObShardingShowDatabasesHandler::ObShardingShowDatabasesHandler(ObMIOBuffer *buf, ObCmdInfo &info)
: ObCmdHandler(buf, info)
{
}

int ObShowDatabasesHandler::handle_show_databases(const ObString &logic_tenant_name,
int ObShardingShowDatabasesHandler::handle_show_databases(const ObString &logic_tenant_name,
ObMysqlClientSession &client_session)
{
int ret = OB_SUCCESS;
Expand Down Expand Up @@ -75,7 +75,7 @@ int ObShowDatabasesHandler::handle_show_databases(const ObString &logic_tenant_n
return ret;
}

int ObShowDatabasesHandler::dump_database_header()
int ObShardingShowDatabasesHandler::dump_database_header()
{
int ret = OB_SUCCESS;
if (OB_FAIL(encode_header(&column_name, &column_type, OB_CC_MAX_DATABASE_COLUMN_ID))) {
Expand All @@ -85,7 +85,7 @@ int ObShowDatabasesHandler::dump_database_header()
return ret;
}

int ObShowDatabasesHandler::dump_database(const ObString &logic_tenant_name,
int ObShardingShowDatabasesHandler::dump_database(const ObString &logic_tenant_name,
ObMysqlClientSession &client_session)
{
int ret = OB_SUCCESS;
Expand Down Expand Up @@ -117,20 +117,20 @@ int ObShowDatabasesHandler::dump_database(const ObString &logic_tenant_name,
return ret;
}

int ObShowDatabasesHandler::show_databases_cmd_callback(ObMIOBuffer *buf, ObCmdInfo &info,
int ObShardingShowDatabasesHandler::show_databases_cmd_callback(ObMIOBuffer *buf, ObCmdInfo &info,
const ObString &logic_tenant_name,
ObMysqlClientSession &client_session)
{
int ret = OB_SUCCESS;
ObShowDatabasesHandler *handler = NULL;
ObShardingShowDatabasesHandler *handler = NULL;

if (OB_ISNULL(handler = new(std::nothrow) ObShowDatabasesHandler(buf, info))) {
if (OB_ISNULL(handler = new(std::nothrow) ObShardingShowDatabasesHandler(buf, info))) {
ret = OB_ALLOCATE_MEMORY_FAILED;
ERROR_CMD("fail to new ObShowDatabasesHandler", K(ret));
ERROR_CMD("fail to new ObShardingShowDatabasesHandler", K(ret));
} else if (OB_FAIL(handler->init())) {
WARN_CMD("fail to init for ObShowDatabasesHandler");
WARN_CMD("fail to init for ObShardingShowDatabasesHandler");
} else if (OB_FAIL(handler->handle_show_databases(logic_tenant_name, client_session))) {
DEBUG_CMD("succ to schedule ObShowDatabasesHandler");
DEBUG_CMD("succ to schedule ObShardingShowDatabasesHandler");
}

if (OB_LIKELY(NULL != handler)) {
Expand Down
8 changes: 4 additions & 4 deletions src/obproxy/cmd/ob_show_databases_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ namespace obutils
{

class ObSqlParseResult;
class ObShowDatabasesHandler : public ObCmdHandler
class ObShardingShowDatabasesHandler : public ObCmdHandler
{
public:
ObShowDatabasesHandler(event::ObMIOBuffer *buf, ObCmdInfo &info);
virtual ~ObShowDatabasesHandler() {}
ObShardingShowDatabasesHandler(event::ObMIOBuffer *buf, ObCmdInfo &info);
virtual ~ObShardingShowDatabasesHandler() {}
int handle_show_databases(const ObString &logic_tenant_name, proxy::ObMysqlClientSession &client_session);

static int show_databases_cmd_callback(event::ObMIOBuffer *buf, ObCmdInfo &info,
Expand All @@ -43,7 +43,7 @@ class ObShowDatabasesHandler : public ObCmdHandler
int dump_database_header();
int dump_database(const ObString &logic_tenant_name, proxy::ObMysqlClientSession &client_session);

DISALLOW_COPY_AND_ASSIGN(ObShowDatabasesHandler);
DISALLOW_COPY_AND_ASSIGN(ObShardingShowDatabasesHandler);
};
} // end of namespace obutils
} // end of namespace obproxy
Expand Down
18 changes: 9 additions & 9 deletions src/obproxy/cmd/ob_show_table_status_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ const ObProxyColumnSchema SHOW_TABLE_STATUS_ARRAY[OB_STS_MAX_COLUMN_ID] = {
ObProxyColumnSchema::make_schema(OB_STS_COMMENT, "Comment", OB_MYSQL_TYPE_VARCHAR),
};

ObShowTableStatusHandler::ObShowTableStatusHandler(ObMIOBuffer *buf, ObCmdInfo &info)
ObShardingShowTableStatusHandler::ObShardingShowTableStatusHandler(ObMIOBuffer *buf, ObCmdInfo &info)
: ObCmdHandler(buf, info)
{
}

int ObShowTableStatusHandler::handle_show_table_status(const ObString &logic_tenant_name, const ObString &logic_database_name,
int ObShardingShowTableStatusHandler::handle_show_table_status(const ObString &logic_tenant_name, const ObString &logic_database_name,
ObString &logic_table_name)
{
int ret = OB_SUCCESS;
Expand Down Expand Up @@ -108,7 +108,7 @@ int ObShowTableStatusHandler::handle_show_table_status(const ObString &logic_ten
return ret;
}

int ObShowTableStatusHandler::dump_table(const ObString &logic_tenant_name, const ObString &logic_database_name,
int ObShardingShowTableStatusHandler::dump_table(const ObString &logic_tenant_name, const ObString &logic_database_name,
ObString &logic_table_name)
{
int ret = OB_SUCCESS;
Expand Down Expand Up @@ -153,20 +153,20 @@ int ObShowTableStatusHandler::dump_table(const ObString &logic_tenant_name, cons
return ret;
}

int ObShowTableStatusHandler::show_table_status_cmd_callback(ObMIOBuffer *buf, ObCmdInfo &info,
int ObShardingShowTableStatusHandler::show_table_status_cmd_callback(ObMIOBuffer *buf, ObCmdInfo &info,
const ObString &logic_tenant_name, const ObString &logic_database_name,
ObString &logic_table_name)
{
int ret = OB_SUCCESS;
ObShowTableStatusHandler *handler = NULL;
ObShardingShowTableStatusHandler *handler = NULL;

if (OB_ISNULL(handler = new(std::nothrow) ObShowTableStatusHandler(buf, info))) {
if (OB_ISNULL(handler = new(std::nothrow) ObShardingShowTableStatusHandler(buf, info))) {
ret = OB_ALLOCATE_MEMORY_FAILED;
ERROR_CMD("fail to new ObShowTableStatusHandler", K(ret));
ERROR_CMD("fail to new ObShardingShowTableStatusHandler", K(ret));
} else if (OB_FAIL(handler->init())) {
WARN_CMD("fail to init for ObShowTableStatusHandler");
WARN_CMD("fail to init for ObShardingShowTableStatusHandler");
} else if (OB_FAIL(handler->handle_show_table_status(logic_tenant_name, logic_database_name, logic_table_name))) {
DEBUG_CMD("succ to schedule ObShowTableStatusHandler");
DEBUG_CMD("succ to schedule ObShardingShowTableStatusHandler");
}

if (OB_LIKELY(NULL != handler)) {
Expand Down
8 changes: 4 additions & 4 deletions src/obproxy/cmd/ob_show_table_status_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ namespace obproxy
{
namespace obutils
{
class ObShowTableStatusHandler : public ObCmdHandler
class ObShardingShowTableStatusHandler : public ObCmdHandler
{
public:
ObShowTableStatusHandler(event::ObMIOBuffer *buf, ObCmdInfo &info);
virtual ~ObShowTableStatusHandler() {}
ObShardingShowTableStatusHandler(event::ObMIOBuffer *buf, ObCmdInfo &info);
virtual ~ObShardingShowTableStatusHandler() {}
int handle_show_table_status(const ObString &logic_tenant_name, const ObString &logic_database_name,
ObString &logic_table_name);

Expand All @@ -37,7 +37,7 @@ class ObShowTableStatusHandler : public ObCmdHandler
int dump_table(const ObString &logic_tenant_name, const ObString &logic_database_name,
ObString &logic_table_name);

DISALLOW_COPY_AND_ASSIGN(ObShowTableStatusHandler);
DISALLOW_COPY_AND_ASSIGN(ObShardingShowTableStatusHandler);
};
} // end of namespace obutils
} // end of namespace obproxy
Expand Down
Loading

0 comments on commit 7ef4057

Please sign in to comment.