提交 b0e85791 编写于 作者: X xy0 提交者: LINGuanRen

fix unity build compilation errors

上级 81df42d4
此差异已折叠。
此差异已折叠。
......@@ -48,7 +48,7 @@ void ObInfoSchemaColumnsTable::reset()
tenant_id_ = OB_INVALID_ID;
}
int ObInfoSchemaColumnsTable::inner_get_next_row(common::ObNewRow*& row)
int ObInfoSchemaColumnsTable::inner_get_next_row(common::ObNewRow *&row)
{
int ret = OB_SUCCESS;
......@@ -60,7 +60,7 @@ int ObInfoSchemaColumnsTable::inner_get_next_row(common::ObNewRow*& row)
SERVER_LOG(WARN, "tenant id is invalid_id", K(ret), K(tenant_id_));
} else {
if (!start_to_read_) {
void* tmp_ptr = NULL;
void *tmp_ptr = NULL;
// If there is no db filter (is_filter_db_: false), At most one loop
// in check_database_table_filter: start_key=MIN,MIN, end_key=MAX,MAX
if (!is_filter_db_ && OB_FAIL(check_database_table_filter())) {
......@@ -69,15 +69,17 @@ int ObInfoSchemaColumnsTable::inner_get_next_row(common::ObNewRow*& row)
} else if (!is_filter_db_ &&
OB_FAIL(schema_guard_->get_database_schemas_in_tenant(tenant_id_, database_schema_array_))) {
SERVER_LOG(WARN, "fail to get database schemas in tenant", K(ret), K(tenant_id_));
} else if (OB_UNLIKELY(NULL == (tmp_ptr = static_cast<char*>(allocator_->alloc(OB_MAX_SYS_PARAM_NAME_LENGTH))))) {
} else if (OB_UNLIKELY(
NULL == (tmp_ptr = static_cast<char *>(allocator_->alloc(OB_MAX_SYS_PARAM_NAME_LENGTH))))) {
ret = OB_ALLOCATE_MEMORY_FAILED;
SERVER_LOG(ERROR, "fail to alloc memory", K(ret));
} else if (FALSE_IT(data_type_str_ = static_cast<char*>(tmp_ptr))) {
} else if (OB_UNLIKELY(NULL == (tmp_ptr = static_cast<char*>(allocator_->alloc(OB_MAX_SYS_PARAM_NAME_LENGTH))))) {
} else if (FALSE_IT(data_type_str_ = static_cast<char *>(tmp_ptr))) {
} else if (OB_UNLIKELY(
NULL == (tmp_ptr = static_cast<char *>(allocator_->alloc(OB_MAX_SYS_PARAM_NAME_LENGTH))))) {
ret = OB_ALLOCATE_MEMORY_FAILED;
SERVER_LOG(ERROR, "fail to alloc memory", K(ret));
} else {
column_type_str_ = static_cast<char*>(tmp_ptr);
column_type_str_ = static_cast<char *>(tmp_ptr);
column_type_str_len_ = OB_MAX_SYS_PARAM_NAME_LENGTH;
}
......@@ -91,7 +93,7 @@ int ObInfoSchemaColumnsTable::inner_get_next_row(common::ObNewRow*& row)
}
bool is_filter_table_schema = false;
for (; OB_SUCC(ret) && i < database_schema_array_.count() && !has_more_; ++i) {
const ObDatabaseSchema* database_schema = database_schema_array_.at(i);
const ObDatabaseSchema *database_schema = database_schema_array_.at(i);
if (OB_ISNULL(database_schema)) {
ret = OB_ERR_UNEXPECTED;
SERVER_LOG(WARN, "database_schema is NULL", K(ret));
......@@ -143,8 +145,8 @@ int ObInfoSchemaColumnsTable::iterate_table_schema_array(
const bool is_filter_table_schema, const int64_t last_db_schema_idx)
{
int ret = OB_SUCCESS;
const ObDatabaseSchema* database_schema = NULL;
ObArray<const ObTableSchema*> table_schema_array;
const ObDatabaseSchema *database_schema = NULL;
ObArray<const ObTableSchema *> table_schema_array;
int64_t table_schema_array_size = 0;
// Handling table_schema_array pagination
int64_t i = 0;
......@@ -172,7 +174,7 @@ int ObInfoSchemaColumnsTable::iterate_table_schema_array(
}
}
for (; OB_SUCC(ret) && i < table_schema_array_size && !has_more_; ++i) {
const ObTableSchema* table_schema = NULL;
const ObTableSchema *table_schema = NULL;
if (is_filter_table_schema) {
table_schema = filter_table_schema_array_.at(i);
} else {
......@@ -206,8 +208,8 @@ int ObInfoSchemaColumnsTable::iterate_table_schema_array(
return ret;
}
int ObInfoSchemaColumnsTable::iterate_column_schema_array(const ObString& database_name,
const share::schema::ObTableSchema& table_schema, const int64_t last_db_schema_idx, const int64_t last_table_idx,
int ObInfoSchemaColumnsTable::iterate_column_schema_array(const ObString &database_name,
const share::schema::ObTableSchema &table_schema, const int64_t last_db_schema_idx, const int64_t last_table_idx,
const bool is_filter_table_schema)
{
int ret = OB_SUCCESS;
......@@ -219,7 +221,7 @@ int ObInfoSchemaColumnsTable::iterate_column_schema_array(const ObString& databa
last_column_idx_ = -1;
}
ObColumnIterByPrevNextID iter(table_schema);
const ObColumnSchemaV2* column_schema = NULL;
const ObColumnSchemaV2 *column_schema = NULL;
for (int j = 0; OB_SUCC(ret) && j < logical_index && OB_SUCC(iter.next(column_schema)); j++) {
// do nothing
}
......@@ -282,10 +284,10 @@ int ObInfoSchemaColumnsTable::check_database_table_filter()
{
int ret = OB_SUCCESS;
for (int64_t i = 0; OB_SUCC(ret) && i < key_ranges_.count(); ++i) {
const ObRowkey& start_key = key_ranges_.at(i).start_key_;
const ObRowkey& end_key = key_ranges_.at(i).end_key_;
const ObObj* start_key_obj_ptr = start_key.get_obj_ptr();
const ObObj* end_key_obj_ptr = end_key.get_obj_ptr();
const ObRowkey &start_key = key_ranges_.at(i).start_key_;
const ObRowkey &end_key = key_ranges_.at(i).end_key_;
const ObObj *start_key_obj_ptr = start_key.get_obj_ptr();
const ObObj *end_key_obj_ptr = end_key.get_obj_ptr();
if (2 != start_key.get_obj_cnt() || 2 != end_key.get_obj_cnt()) {
ret = OB_ERR_UNEXPECTED;
SERVER_LOG(WARN,
......@@ -304,14 +306,14 @@ int ObInfoSchemaColumnsTable::check_database_table_filter()
// is db_name + table_name, so there is no need to obtain all database_schema under the tenant
is_filter_db_ = true;
ObString database_name = start_key_obj_ptr[0].get_varchar();
const ObDatabaseSchema* filter_database_schema = NULL;
const ObDatabaseSchema *filter_database_schema = NULL;
if (OB_FAIL(schema_guard_->get_database_schema(tenant_id_, database_name, filter_database_schema))) {
SERVER_LOG(WARN, "fail to get database schema", K(ret), K(tenant_id_), K(database_name));
} else if (NULL == filter_database_schema) {
} else if (start_key_obj_ptr[1].is_varchar_or_char() && end_key_obj_ptr[1].is_varchar_or_char() &&
start_key_obj_ptr[1] == end_key_obj_ptr[1]) {
// Specify db_name and tbl_name at the same time
const ObTableSchema* filter_table_schema = NULL;
const ObTableSchema *filter_table_schema = NULL;
ObString table_name = start_key_obj_ptr[1].get_varchar();
if (OB_FAIL(schema_guard_->get_table_schema(tenant_id_,
filter_database_schema->get_database_id(),
......@@ -333,8 +335,8 @@ int ObInfoSchemaColumnsTable::check_database_table_filter()
return ret;
}
int ObInfoSchemaColumnsTable::get_type_str(const ObObjMeta& obj_meta, const ObAccuracy& accuracy,
const common::ObIArray<ObString>& type_info, const int16_t default_length_semantics, int64_t& pos)
int ObInfoSchemaColumnsTable::get_type_str(const ObObjMeta &obj_meta, const ObAccuracy &accuracy,
const common::ObIArray<ObString> &type_info, const int16_t default_length_semantics, int64_t &pos)
{
int ret = OB_SUCCESS;
......@@ -342,7 +344,7 @@ int ObInfoSchemaColumnsTable::get_type_str(const ObObjMeta& obj_meta, const ObAc
obj_meta, accuracy, type_info, default_length_semantics, column_type_str_, column_type_str_len_, pos))) {
if (OB_MAX_SYS_PARAM_NAME_LENGTH == column_type_str_len_ && OB_SIZE_OVERFLOW == ret) {
if (OB_UNLIKELY(
NULL == (column_type_str_ = static_cast<char*>(allocator_->realloc(
NULL == (column_type_str_ = static_cast<char *>(allocator_->realloc(
column_type_str_, OB_MAX_SYS_PARAM_NAME_LENGTH, OB_MAX_EXTENDED_TYPE_INFO_LENGTH))))) {
ret = OB_ALLOCATE_MEMORY_FAILED;
SERVER_LOG(ERROR, "fail to alloc memory", K(ret));
......@@ -357,8 +359,8 @@ int ObInfoSchemaColumnsTable::get_type_str(const ObObjMeta& obj_meta, const ObAc
return ret;
}
int ObInfoSchemaColumnsTable::fill_row_cells(const ObString& database_name, const ObTableSchema* table_schema,
const ObColumnSchemaV2* column_schema, const uint64_t ordinal_position)
int ObInfoSchemaColumnsTable::fill_row_cells(const ObString &database_name, const ObTableSchema *table_schema,
const ObColumnSchemaV2 *column_schema, const uint64_t ordinal_position)
{
int ret = OB_SUCCESS;
......@@ -370,7 +372,7 @@ int ObInfoSchemaColumnsTable::fill_row_cells(const ObString& database_name, cons
ret = OB_ERR_UNEXPECTED;
SERVER_LOG(WARN, "table_schema or column_schema is NULL", K(ret));
} else {
ObObj* cells = NULL;
ObObj *cells = NULL;
const int64_t col_count = output_column_ids_.count();
if (OB_ISNULL(cells = cur_row_.cells_)) {
ret = OB_ERR_UNEXPECTED;
......@@ -416,17 +418,17 @@ int ObInfoSchemaColumnsTable::fill_row_cells(const ObString& database_name, cons
}
case COLUMN_DEFAULT: {
casted_cell.reset();
const ObObj* res_cell = NULL;
const ObObj *res_cell = NULL;
ObObj def_obj = column_schema->get_cur_default_value();
if (IS_DEFAULT_NOW_OBJ(def_obj)) {
ObObj def_now_obj;
def_now_obj.set_varchar(ObString::make_string(N_UPPERCASE_CUR_TIMESTAMP));
cells[cell_idx] = def_now_obj;
} else if (def_obj.is_bit() || ob_is_enum_or_set_type(def_obj.get_type())) {
char* buf = NULL;
char *buf = NULL;
int64_t buf_len = number::ObNumber::MAX_PRINTABLE_SIZE;
int64_t pos = 0;
if (OB_UNLIKELY(NULL == (buf = static_cast<char*>(allocator_->alloc(buf_len))))) {
if (OB_UNLIKELY(NULL == (buf = static_cast<char *>(allocator_->alloc(buf_len))))) {
ret = OB_ALLOCATE_MEMORY_FAILED;
SERVER_LOG(ERROR, "fail to allocate memory", K(ret));
} else if (def_obj.is_bit()) {
......@@ -594,10 +596,10 @@ int ObInfoSchemaColumnsTable::fill_row_cells(const ObString& database_name, cons
if (0 == scale) {
extra = ObString::make_string("on update current_timestamp");
} else {
char* buf = NULL;
char *buf = NULL;
int64_t buf_len = 32;
int64_t pos = 0;
if (OB_UNLIKELY(NULL == (buf = static_cast<char*>(allocator_->alloc(buf_len))))) {
if (OB_UNLIKELY(NULL == (buf = static_cast<char *>(allocator_->alloc(buf_len))))) {
ret = OB_ALLOCATE_MEMORY_FAILED;
SERVER_LOG(WARN, "fail to allocate memory", K(ret));
} else if (OB_FAIL(databuff_printf(buf, buf_len, pos, "on update current_timestamp(%d)", scale))) {
......
......@@ -56,7 +56,7 @@ public:
ObInfoSchemaColumnsTable();
virtual ~ObInfoSchemaColumnsTable();
virtual int inner_get_next_row(common::ObNewRow*& row);
virtual int inner_get_next_row(common::ObNewRow *&row);
virtual void reset();
inline void set_tenant_id(uint64_t tenant_id)
......@@ -66,8 +66,8 @@ public:
private:
DISALLOW_COPY_AND_ASSIGN(ObInfoSchemaColumnsTable);
int fill_row_cells(const common::ObString& database_name, const share::schema::ObTableSchema* table_schema,
const share::schema::ObColumnSchemaV2* column_schema, const uint64_t ordinal_position);
int fill_row_cells(const common::ObString &database_name, const share::schema::ObTableSchema *table_schema,
const share::schema::ObColumnSchemaV2 *column_schema, const uint64_t ordinal_position);
int check_database_table_filter();
/**
* Iterate through all the tables and fill row cells,
......@@ -76,8 +76,8 @@ private:
*/
int iterate_table_schema_array(const bool is_filter_table_schema, const int64_t last_db_schema_idx);
// Iterate through all the columns and fill cells
int iterate_column_schema_array(const common::ObString& database_name,
const share::schema::ObTableSchema& table_schema, const int64_t last_db_schema_idx, const int64_t last_table_idx,
int iterate_column_schema_array(const common::ObString &database_name,
const share::schema::ObTableSchema &table_schema, const int64_t last_db_schema_idx, const int64_t last_table_idx,
const bool is_filter_table_schema);
/**
* If ob_sql_type_str failed to call, and the error code returned is OB_SIZE_OVERFLOW.
......@@ -85,8 +85,8 @@ private:
*/
int get_type_str(const ObObjMeta &obj_meta, const ObAccuracy &accuracy, const common::ObIArray<ObString> &type_info,
const int16_t default_length_semantics, int64_t &pos);
int fill_col_privs(ObSessionPrivInfo &session_priv, ObNeedPriv &need_priv, ObPrivSet priv_set, const char *priv_str,
char *buf, const int64_t buf_len, int64_t &pos);
int fill_col_privs(share::schema::ObSessionPrivInfo &session_priv, share::schema::ObNeedPriv &need_priv,
ObPrivSet priv_set, const char *priv_str, char *buf, const int64_t buf_len, int64_t &pos);
private:
uint64_t tenant_id_;
......@@ -94,14 +94,14 @@ private:
int64_t last_table_idx_;
int64_t last_column_idx_;
bool has_more_;
char* data_type_str_;
char* column_type_str_;
char *data_type_str_;
char *column_type_str_;
int64_t column_type_str_len_;
bool is_filter_db_;
int64_t last_filter_table_idx_;
int64_t last_filter_column_idx_;
common::ObSEArray<const share::schema::ObDatabaseSchema*, 8> database_schema_array_;
common::ObSEArray<const share::schema::ObTableSchema*, 16> filter_table_schema_array_;
common::ObSEArray<const share::schema::ObDatabaseSchema *, 8> database_schema_array_;
common::ObSEArray<const share::schema::ObTableSchema *, 16> filter_table_schema_array_;
};
} // namespace observer
} // namespace oceanbase
......
......@@ -14,6 +14,8 @@
#include "ob_root_backup.h"
#include "share/backup/ob_backup_operator.h"
#include "share/backup/ob_extern_backup_info_mgr.h"
#include "share/schema/ob_schema_mgr.h"
#include "share/schema/ob_schema_struct.h"
#include "ob_root_balancer.h"
#include "ob_rs_event_history_table_operator.h"
#include "share/backup/ob_tenant_backup_clean_info_updater.h"
......@@ -775,7 +777,7 @@ int ObRootBackup::do_tenant_backup(const share::ObBaseBackupInfoStruct &info, sh
if (OB_FAIL(ret)) {
if (ObBackupUtils::is_need_retry_error(ret)) {
//do nothing
// do nothing
} else {
dest_task_info = task_info;
dest_task_info.result_ = ret;
......
......@@ -12,13 +12,14 @@
#define USING_LOG_PREFIX SHARE
#include "share/backup/ob_backup_backuppiece_operator.h"
#include "share/inner_table/ob_inner_table_schema_constants.h"
using namespace oceanbase::share;
namespace oceanbase {
namespace share {
int ObIBackupBackupPieceJobOperator::fill_one_item(const ObBackupBackupPieceJobInfo& item, ObDMLSqlSplicer& splicer)
int ObIBackupBackupPieceJobOperator::fill_one_item(const ObBackupBackupPieceJobInfo &item, ObDMLSqlSplicer &splicer)
{
int ret = OB_SUCCESS;
char backup_dest_str[OB_MAX_BACKUP_DEST_LENGTH] = "";
......@@ -43,7 +44,7 @@ int ObIBackupBackupPieceJobOperator::fill_one_item(const ObBackupBackupPieceJobI
}
int ObIBackupBackupPieceJobOperator::extract_one_item(
sqlclient::ObMySQLResult* result, ObBackupBackupPieceJobInfo& item)
sqlclient::ObMySQLResult *result, ObBackupBackupPieceJobInfo &item)
{
int ret = OB_SUCCESS;
int64_t tmp_real_str_len = 0;
......@@ -77,13 +78,13 @@ int ObIBackupBackupPieceJobOperator::extract_one_item(
return ret;
}
int ObIBackupBackupPieceJobOperator::get_item_list(const common::ObSqlString& sql, common::ObISQLClient& proxy,
common::ObIArray<ObBackupBackupPieceJobInfo>& item_list)
int ObIBackupBackupPieceJobOperator::get_item_list(const common::ObSqlString &sql, common::ObISQLClient &proxy,
common::ObIArray<ObBackupBackupPieceJobInfo> &item_list)
{
int ret = OB_SUCCESS;
SMART_VAR(ObMySQLProxy::MySQLResult, res)
{
sqlclient::ObMySQLResult* result = NULL;
sqlclient::ObMySQLResult *result = NULL;
if (OB_UNLIKELY(!sql.is_valid())) {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("invalid arguments", KR(ret), K(sql));
......@@ -113,7 +114,7 @@ int ObIBackupBackupPieceJobOperator::get_item_list(const common::ObSqlString& sq
return ret;
}
int ObBackupBackupPieceJobOperator::insert_job_item(const ObBackupBackupPieceJobInfo& item, common::ObISQLClient& proxy)
int ObBackupBackupPieceJobOperator::insert_job_item(const ObBackupBackupPieceJobInfo &item, common::ObISQLClient &proxy)
{
int ret = OB_SUCCESS;
ObSqlString sql;
......@@ -138,7 +139,7 @@ int ObBackupBackupPieceJobOperator::insert_job_item(const ObBackupBackupPieceJob
}
int ObBackupBackupPieceJobOperator::get_all_job_items(
common::ObISQLClient& proxy, common::ObIArray<ObBackupBackupPieceJobInfo>& items)
common::ObISQLClient &proxy, common::ObIArray<ObBackupBackupPieceJobInfo> &items)
{
int ret = OB_SUCCESS;
items.reset();
......@@ -152,7 +153,7 @@ int ObBackupBackupPieceJobOperator::get_all_job_items(
}
int ObBackupBackupPieceJobOperator::get_one_job(
common::ObISQLClient& proxy, common::ObIArray<ObBackupBackupPieceJobInfo>& items)
common::ObISQLClient &proxy, common::ObIArray<ObBackupBackupPieceJobInfo> &items)
{
int ret = OB_SUCCESS;
items.reset();
......@@ -166,7 +167,7 @@ int ObBackupBackupPieceJobOperator::get_one_job(
}
int ObBackupBackupPieceJobOperator::get_job_item(
const int64_t job_id, common::ObISQLClient& proxy, ObBackupBackupPieceJobInfo& item)
const int64_t job_id, common::ObISQLClient &proxy, ObBackupBackupPieceJobInfo &item)
{
int ret = OB_SUCCESS;
item.reset();
......@@ -193,7 +194,7 @@ int ObBackupBackupPieceJobOperator::get_job_item(
return ret;
}
int ObBackupBackupPieceJobOperator::report_job_item(const ObBackupBackupPieceJobInfo& item, common::ObISQLClient& proxy)
int ObBackupBackupPieceJobOperator::report_job_item(const ObBackupBackupPieceJobInfo &item, common::ObISQLClient &proxy)
{
int ret = OB_SUCCESS;
int64_t affected_rows = 0;
......@@ -224,7 +225,7 @@ int ObBackupBackupPieceJobOperator::report_job_item(const ObBackupBackupPieceJob
return ret;
}
int ObBackupBackupPieceJobOperator::remove_job_item(const int64_t job_id, common::ObISQLClient& proxy)
int ObBackupBackupPieceJobOperator::remove_job_item(const int64_t job_id, common::ObISQLClient &proxy)
{
int ret = OB_SUCCESS;
int64_t affected_rows = 0;
......@@ -242,7 +243,7 @@ int ObBackupBackupPieceJobOperator::remove_job_item(const int64_t job_id, common
}
int ObBackupBackupPieceJobHistoryOperator::insert_job_item(
const ObBackupBackupPieceJobInfo& item, common::ObISQLClient& proxy)
const ObBackupBackupPieceJobInfo &item, common::ObISQLClient &proxy)
{
int ret = OB_SUCCESS;
ObSqlString sql;
......@@ -267,7 +268,7 @@ int ObBackupBackupPieceJobHistoryOperator::insert_job_item(
}
int ObBackupBackupPieceJobHistoryOperator::get_job_item(
const int64_t job_id, common::ObISQLClient& proxy, ObBackupBackupPieceJobInfo& item)
const int64_t job_id, common::ObISQLClient &proxy, ObBackupBackupPieceJobInfo &item)
{
int ret = OB_SUCCESS;
item.reset();
......@@ -295,7 +296,7 @@ int ObBackupBackupPieceJobHistoryOperator::get_job_item(
}
int ObBackupBackupPieceJobHistoryOperator::report_job_item(
const ObBackupBackupPieceJobInfo& item, common::ObISQLClient& proxy)
const ObBackupBackupPieceJobInfo &item, common::ObISQLClient &proxy)
{
int ret = OB_SUCCESS;
int64_t affected_rows = 0;
......@@ -323,7 +324,7 @@ int ObBackupBackupPieceJobHistoryOperator::report_job_item(
return ret;
}
int ObBackupBackupPieceJobHistoryOperator::remove_job_item(const int64_t job_id, common::ObISQLClient& proxy)
int ObBackupBackupPieceJobHistoryOperator::remove_job_item(const int64_t job_id, common::ObISQLClient &proxy)
{
int ret = OB_SUCCESS;
int64_t affected_rows = 0;
......@@ -340,7 +341,7 @@ int ObBackupBackupPieceJobHistoryOperator::remove_job_item(const int64_t job_id,
return ret;
}
int ObIBackupBackupPieceTaskOperator::fill_one_item(const ObBackupBackupPieceTaskInfo& item, ObDMLSqlSplicer& splicer)
int ObIBackupBackupPieceTaskOperator::fill_one_item(const ObBackupBackupPieceTaskInfo &item, ObDMLSqlSplicer &splicer)
{
int ret = OB_SUCCESS;
char backup_dest_str[OB_MAX_BACKUP_DEST_LENGTH] = "";
......@@ -367,7 +368,7 @@ int ObIBackupBackupPieceTaskOperator::fill_one_item(const ObBackupBackupPieceTas
}
int ObIBackupBackupPieceTaskOperator::extract_one_item(
sqlclient::ObMySQLResult* result, ObBackupBackupPieceTaskInfo& item)
sqlclient::ObMySQLResult *result, ObBackupBackupPieceTaskInfo &item)
{
int ret = OB_SUCCESS;
int64_t tmp_real_str_len = 0;
......@@ -405,13 +406,13 @@ int ObIBackupBackupPieceTaskOperator::extract_one_item(
return ret;
}
int ObIBackupBackupPieceTaskOperator::get_item_list(const common::ObSqlString& sql, common::ObISQLClient& proxy,
common::ObIArray<ObBackupBackupPieceTaskInfo>& item_list)
int ObIBackupBackupPieceTaskOperator::get_item_list(const common::ObSqlString &sql, common::ObISQLClient &proxy,
common::ObIArray<ObBackupBackupPieceTaskInfo> &item_list)
{
int ret = OB_SUCCESS;
SMART_VAR(ObMySQLProxy::MySQLResult, res)
{
sqlclient::ObMySQLResult* result = NULL;
sqlclient::ObMySQLResult *result = NULL;
if (OB_UNLIKELY(!sql.is_valid())) {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("invalid arguments", KR(ret), K(sql));
......@@ -442,13 +443,13 @@ int ObIBackupBackupPieceTaskOperator::get_item_list(const common::ObSqlString& s
}
int ObBackupBackupPieceTaskOperator::get_job_task_count(
const ObBackupBackupPieceJobInfo& job_info, common::ObISQLClient& sql_proxy, int64_t& task_count)
const ObBackupBackupPieceJobInfo &job_info, common::ObISQLClient &sql_proxy, int64_t &task_count)
{
int ret = OB_SUCCESS;
const int64_t job_id = job_info.job_id_;
task_count = 0;
ObSqlString sql;
sqlclient::ObMySQLResult* result = NULL;
sqlclient::ObMySQLResult *result = NULL;
SMART_VAR(ObMySQLProxy::ReadResult, res)
{
if (OB_FAIL(sql.assign_fmt(
......@@ -472,7 +473,7 @@ int ObBackupBackupPieceTaskOperator::get_job_task_count(
}
int ObBackupBackupPieceTaskOperator::insert_task_item(
const ObBackupBackupPieceTaskInfo& item, common::ObISQLClient& proxy)
const ObBackupBackupPieceTaskInfo &item, common::ObISQLClient &proxy)
{
int ret = OB_SUCCESS;
ObSqlString sql;
......@@ -497,7 +498,7 @@ int ObBackupBackupPieceTaskOperator::insert_task_item(
}
int ObBackupBackupPieceTaskOperator::get_all_task_items(
const int64_t job_id, common::ObISQLClient& proxy, ObIArray<ObBackupBackupPieceTaskInfo>& items)
const int64_t job_id, common::ObISQLClient &proxy, ObIArray<ObBackupBackupPieceTaskInfo> &items)
{
int ret = OB_SUCCESS;
items.reset();
......@@ -511,7 +512,7 @@ int ObBackupBackupPieceTaskOperator::get_all_task_items(
}
int ObBackupBackupPieceTaskOperator::get_doing_task_items(const int64_t job_id, const uint64_t tenant_id,
common::ObISQLClient& proxy, common::ObIArray<ObBackupBackupPieceTaskInfo>& items)
common::ObISQLClient &proxy, common::ObIArray<ObBackupBackupPieceTaskInfo> &items)
{
int ret = OB_SUCCESS;
items.reset();
......@@ -531,7 +532,7 @@ int ObBackupBackupPieceTaskOperator::get_doing_task_items(const int64_t job_id,
}
int ObBackupBackupPieceTaskOperator::get_task_item(const int64_t job_id, const int64_t tenant_id,
const int64_t piece_id, common::ObISQLClient& proxy, ObBackupBackupPieceTaskInfo& item)
const int64_t piece_id, common::ObISQLClient &proxy, ObBackupBackupPieceTaskInfo &item)
{
int ret = OB_SUCCESS;
ObArray<ObBackupBackupPieceTaskInfo> item_list;
......@@ -560,7 +561,7 @@ int ObBackupBackupPieceTaskOperator::get_task_item(const int64_t job_id, const i
}
int ObBackupBackupPieceTaskOperator::get_smallest_doing_task(
const int64_t job_id, const uint64_t tenant_id, common::ObISQLClient& proxy, ObBackupBackupPieceTaskInfo& item)
const int64_t job_id, const uint64_t tenant_id, common::ObISQLClient &proxy, ObBackupBackupPieceTaskInfo &item)
{
int ret = OB_SUCCESS;
ObArray<ObBackupBackupPieceTaskInfo> item_list;
......@@ -589,7 +590,7 @@ int ObBackupBackupPieceTaskOperator::get_smallest_doing_task(
}
int ObBackupBackupPieceTaskOperator::update_task_finish(
const uint64_t tenant_id, const int64_t job_id, const int64_t piece_id, common::ObISQLClient& proxy)
const uint64_t tenant_id, const int64_t job_id, const int64_t piece_id, common::ObISQLClient &proxy)
{
int ret = OB_SUCCESS;
ObSqlString sql;
......@@ -615,7 +616,7 @@ int ObBackupBackupPieceTaskOperator::update_task_finish(
}
int ObBackupBackupPieceTaskOperator::report_task_item(
const ObBackupBackupPieceTaskInfo& item, common::ObISQLClient& proxy)
const ObBackupBackupPieceTaskInfo &item, common::ObISQLClient &proxy)
{
int ret = OB_SUCCESS;
int64_t affected_rows = 0;
......@@ -646,7 +647,7 @@ int ObBackupBackupPieceTaskOperator::report_task_item(
return ret;
}
int ObBackupBackupPieceTaskOperator::remove_task_items(const int64_t job_id, common::ObISQLClient& proxy)
int ObBackupBackupPieceTaskOperator::remove_task_items(const int64_t job_id, common::ObISQLClient &proxy)
{
int ret = OB_SUCCESS;
int64_t affected_rows = 0;
......@@ -664,7 +665,7 @@ int ObBackupBackupPieceTaskOperator::remove_task_items(const int64_t job_id, com
}
int ObBackupBackupPieceTaskHistoryOperator::insert_task_item(
const ObBackupBackupPieceTaskInfo& item, common::ObISQLClient& proxy)
const ObBackupBackupPieceTaskInfo &item, common::ObISQLClient &proxy)
{
int ret = OB_SUCCESS;
ObSqlString sql;
......@@ -689,7 +690,7 @@ int ObBackupBackupPieceTaskHistoryOperator::insert_task_item(
}
int ObBackupBackupPieceTaskHistoryOperator::get_task_items(
const int64_t job_id, common::ObISQLClient& proxy, common::ObIArray<ObBackupBackupPieceTaskInfo>& items)
const int64_t job_id, common::ObISQLClient &proxy, common::ObIArray<ObBackupBackupPieceTaskInfo> &items)
{
int ret = OB_SUCCESS;
items.reset();
......@@ -707,7 +708,7 @@ int ObBackupBackupPieceTaskHistoryOperator::get_task_items(
}
int ObBackupBackupPieceTaskHistoryOperator::report_task_item(
const ObBackupBackupPieceTaskInfo& item, common::ObISQLClient& proxy)
const ObBackupBackupPieceTaskInfo &item, common::ObISQLClient &proxy)
{
int ret = OB_SUCCESS;
int64_t affected_rows = 0;
......@@ -736,7 +737,7 @@ int ObBackupBackupPieceTaskHistoryOperator::report_task_item(
}
int ObBackupBackupPieceTaskHistoryOperator::report_task_items(
const common::ObIArray<ObBackupBackupPieceTaskInfo>& items, common::ObISQLClient& proxy)
const common::ObIArray<ObBackupBackupPieceTaskInfo> &items, common::ObISQLClient &proxy)
{
int ret = OB_SUCCESS;
ObSqlString sql;
......@@ -751,7 +752,7 @@ int ObBackupBackupPieceTaskHistoryOperator::report_task_items(
const int64_t remain_cnt = items.count() - report_idx;
int64_t cur_batch_cnt = remain_cnt < BATCH_CNT ? remain_cnt : BATCH_CNT;
for (int64_t i = 0; OB_SUCC(ret) && i < cur_batch_cnt; ++i) {
const ObBackupBackupPieceTaskInfo& item = items.at(report_idx + i);
const ObBackupBackupPieceTaskInfo &item = items.at(report_idx + i);
splicer.reuse();
if (OB_FAIL(ObIBackupBackupPieceTaskOperator::fill_one_item(item, splicer))) {
LOG_WARN("failed to fill one item", KR(ret), K(item));
......
此差异已折叠。
......@@ -17,21 +17,22 @@
#include "sql/resolver/cmd/ob_variable_set_resolver.h"
#include "sql/resolver/cmd/ob_variable_set_stmt.h"
#include "sql/session/ob_sql_session_info.h"
#include "sql/resolver/cmd/ob_variable_set_resolver.h"
namespace oceanbase {
using namespace common;
using namespace share;
namespace sql {
ObVariableSetResolver::ObVariableSetResolver(ObResolverParams& params) : ObStmtResolver(params)
ObVariableSetResolver::ObVariableSetResolver(ObResolverParams &params) : ObStmtResolver(params)
{}
ObVariableSetResolver::~ObVariableSetResolver()
{}
int ObVariableSetResolver::resolve(const ParseNode& parse_tree)
int ObVariableSetResolver::resolve(const ParseNode &parse_tree)
{
int ret = OB_SUCCESS;
ObVariableSetStmt* variable_set_stmt = NULL;
ObVariableSetStmt *variable_set_stmt = NULL;
if (OB_UNLIKELY(T_VARIABLE_SET != parse_tree.type_)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("parse_tree.type_ must be T_VARIABLE_SET", K(ret), K(parse_tree.type_));
......@@ -44,7 +45,7 @@ int ObVariableSetResolver::resolve(const ParseNode& parse_tree)
} else {
stmt_ = variable_set_stmt;
variable_set_stmt->set_actual_tenant_id(session_info_->get_effective_tenant_id());
ParseNode* set_node = NULL;
ParseNode *set_node = NULL;
ObVariableSetStmt::VariableSetNode var_node;
ObVariableSetStmt::NamesSetNode names_node;
for (int64_t i = 0; OB_SUCC(ret) && i < parse_tree.num_child_; ++i) {
......@@ -57,7 +58,7 @@ int ObVariableSetResolver::resolve(const ParseNode& parse_tree)
}
} else if (T_SET_NAMES == set_node->type_ || T_SET_CHARSET == set_node->type_) {
if (OB_FAIL(resolve_set_names(*set_node, names_node)))
LOG_WARN("resolve set names failed", K(ret));
LOG_WARN("resolve set names failed", K(ret));
} else {
ret = OB_ERR_UNEXPECTED;
LOG_ERROR("unexpected set_node->type_ ", K(ret), K(set_node->type_));
......@@ -74,12 +75,11 @@ int ObVariableSetResolver::resolve(const ParseNode& parse_tree)
return ret;
}
int ObVariableSetResolver::resolve_set_variable(const ParseNode &set_node,
ObVariableSetStmt::VariableSetNode &var_node,
ObVariableSetStmt* variable_set_stmt)
int ObVariableSetResolver::resolve_set_variable(
const ParseNode &set_node, ObVariableSetStmt::VariableSetNode &var_node, ObVariableSetStmt *variable_set_stmt)
{
int ret = OB_SUCCESS;
ParseNode* var = NULL;
ParseNode *var = NULL;
switch (set_node.value_) {
case 0:
var_node.set_scope_ = ObSetVar::SET_SCOPE_SESSION;
......@@ -105,7 +105,7 @@ int ObVariableSetResolver::resolve_set_variable(const ParseNode &set_node,
var_node.is_system_variable_ = true;
var_name.assign_ptr(var->str_value_, static_cast<int32_t>(var->str_len_));
} else if (T_OBJ_ACCESS_REF == var->type_) { // Oracle mode
const ParseNode* name_node = NULL;
const ParseNode *name_node = NULL;
if (OB_ISNULL(name_node = var->children_[0]) || OB_UNLIKELY(var->children_[1] != NULL)) {
ret = OB_NOT_SUPPORTED;
LOG_USER_ERROR(OB_NOT_SUPPORTED, "Variable name not an identifier type");
......@@ -171,18 +171,15 @@ int ObVariableSetResolver::resolve_set_variable(const ParseNode &set_node,
}
if (OB_SUCC(ret)) {
if (0 == var_node.variable_name_.case_compare("ob_compatibility_mode") &&
0 == strncasecmp(
value_node.str_value_, "oracle", std::min(static_cast<int32_t>(value_node.str_len_), 6))) {
0 == strncasecmp(value_node.str_value_, "oracle", std::min(static_cast<int32_t>(value_node.str_len_), 6))) {
ret = OB_NOT_SUPPORTED;
LOG_USER_ERROR(OB_NOT_SUPPORTED, "Not support oracle mode");
} else if (OB_FAIL(
ObResolverUtils::resolve_const_expr(params_, value_node, var_node.value_expr_, NULL))) {
} else if (OB_FAIL(ObResolverUtils::resolve_const_expr(params_, value_node, var_node.value_expr_, NULL))) {
LOG_WARN("resolve variable value failed", K(ret));
}
}
} else {
if (OB_FAIL(ObResolverUtils::resolve_const_expr(
params_, *set_node.children_[1], var_node.value_expr_, NULL))) {
if (OB_FAIL(ObResolverUtils::resolve_const_expr(params_, *set_node.children_[1], var_node.value_expr_, NULL))) {
LOG_WARN("resolve variable value failed", K(ret));
}
}
......@@ -190,8 +187,7 @@ int ObVariableSetResolver::resolve_set_variable(const ParseNode &set_node,
return ret;
}
int ObVariableSetResolver::resolve_set_names(const ParseNode &set_node,
ObVariableSetStmt::NamesSetNode &names_node)
int ObVariableSetResolver::resolve_set_names(const ParseNode &set_node, ObVariableSetStmt::NamesSetNode &names_node)
{
int ret = OB_SUCCESS;
if (OB_ISNULL(set_node.children_)) {
......@@ -209,8 +205,7 @@ int ObVariableSetResolver::resolve_set_names(const ParseNode &set_node,
} else {
names_node.is_default_charset_ = false;
ObString charset;
charset.assign_ptr(
set_node.children_[0]->str_value_, static_cast<int32_t>(set_node.children_[0]->str_len_));
charset.assign_ptr(set_node.children_[0]->str_value_, static_cast<int32_t>(set_node.children_[0]->str_len_));
if (0 == charset.case_compare("utf16")) {
ret = OB_ERR_WRONG_VALUE_FOR_VAR;
LOG_USER_ERROR(OB_ERR_WRONG_VALUE_FOR_VAR,
......@@ -240,8 +235,8 @@ int ObVariableSetResolver::resolve_set_names(const ParseNode &set_node,
names_node.is_default_charset_ = true;
} else {
names_node.is_default_charset_ = false;
names_node.charset_.assign_ptr(set_node.children_[0]->str_value_,
static_cast<int32_t>(set_node.children_[0]->str_len_));
names_node.charset_.assign_ptr(
set_node.children_[0]->str_value_, static_cast<int32_t>(set_node.children_[0]->str_len_));
}
}
}
......@@ -249,19 +244,17 @@ int ObVariableSetResolver::resolve_set_names(const ParseNode &set_node,
return ret;
}
ObAlterSessionSetResolver::ObAlterSessionSetResolver(ObResolverParams& params) : ObStmtResolver(params)
ObAlterSessionSetResolver::ObAlterSessionSetResolver(ObResolverParams &params) : ObStmtResolver(params)
{}
ObAlterSessionSetResolver::~ObAlterSessionSetResolver()
{}
// for oracle mode grammer: alter session set sys_var = val
int ObAlterSessionSetResolver::resolve(const ParseNode& parse_tree)
int ObAlterSessionSetResolver::resolve(const ParseNode &parse_tree)
{
int ret = OB_SUCCESS;
ObVariableSetStmt* variable_set_stmt = NULL;
ObVariableSetStmt *variable_set_stmt = NULL;
if (OB_UNLIKELY(T_ALTER_SESSION_SET != parse_tree.type_)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("parse_tree.type_ must be T_ALTER_SESSION_SET", K(ret), K(parse_tree.type_));
......@@ -275,8 +268,8 @@ int ObAlterSessionSetResolver::resolve(const ParseNode& parse_tree)
// start resolve
stmt_ = variable_set_stmt;
variable_set_stmt->set_actual_tenant_id(session_info_->get_effective_tenant_id());
ParseNode* set_clause_node = NULL;
ParseNode* set_param_node = NULL;
ParseNode *set_clause_node = NULL;
ParseNode *set_param_node = NULL;
ObVariableSetStmt::VariableSetNode var_node;
// resolve alter_session_set_clause
if (OB_ISNULL(set_clause_node = parse_tree.children_[0])) {
......@@ -296,7 +289,7 @@ int ObAlterSessionSetResolver::resolve(const ParseNode& parse_tree)
LOG_WARN("set_node->type_ must be T_VAR_VAL", K(ret), K(set_param_node->type_));
} else {
// resolve set_system_parameter_clause
ParseNode* var = NULL;
ParseNode *var = NULL;
var_node.set_scope_ = ObSetVar::SET_SCOPE_SESSION;
if (OB_ISNULL(var = set_param_node->children_[0])) {
ret = OB_ERR_UNEXPECTED;
......@@ -332,8 +325,8 @@ int ObAlterSessionSetResolver::resolve(const ParseNode& parse_tree)
}
}
}
if (OB_SUCC(ret) && OB_FAIL(variable_set_stmt->add_variable_node(
ObVariableSetStmt::make_variable_name_node(var_node)))) {
if (OB_SUCC(ret) &&
OB_FAIL(variable_set_stmt->add_variable_node(ObVariableSetStmt::make_variable_name_node(var_node)))) {
LOG_WARN("Add set entry failed", K(ret));
}
}
......
......@@ -14,17 +14,19 @@
#define OCEANBASE_SQL_RESOLVER_CMD_OB_VARIALBLE_SET_RESOLVER_
#include "sql/resolver/ob_stmt_resolver.h"
#include "sql/resolver/cmd/ob_variable_set_resolver.h"
#include "sql/resolver/cmd/ob_variable_set_stmt.h"
namespace oceanbase {
namespace sql {
class ObVariableSetResolver : public ObStmtResolver {
public:
explicit ObVariableSetResolver(ObResolverParams& params);
explicit ObVariableSetResolver(ObResolverParams &params);
virtual ~ObVariableSetResolver();
virtual int resolve(const ParseNode& parse_tree);
int resolve_set_variable(const ParseNode &set_node, ObVariableSetStmt::VariableSetNode &var_node,
ObVariableSetStmt* variable_set_stmt);
virtual int resolve(const ParseNode &parse_tree);
int resolve_set_variable(
const ParseNode &set_node, ObVariableSetStmt::VariableSetNode &var_node, ObVariableSetStmt *variable_set_stmt);
int resolve_set_names(const ParseNode &set_node, ObVariableSetStmt::NamesSetNode &names_node);
private:
......@@ -33,10 +35,10 @@ private:
class ObAlterSessionSetResolver : public ObStmtResolver {
public:
explicit ObAlterSessionSetResolver(ObResolverParams& params);
explicit ObAlterSessionSetResolver(ObResolverParams &params);
virtual ~ObAlterSessionSetResolver();
virtual int resolve(const ParseNode& parse_tree);
virtual int resolve(const ParseNode &parse_tree);
private:
DISALLOW_COPY_AND_ASSIGN(ObAlterSessionSetResolver);
......
此差异已折叠。
......@@ -16,6 +16,7 @@
#include "share/ob_errno.h"
#include "share/schema/ob_schema_struct.h"
#include "share/schema/ob_table_dml_param.h"
#include "sql/engine/expr/ob_expr.h"
namespace oceanbase {
namespace storage {
......@@ -23,13 +24,13 @@ using namespace common;
using namespace share::schema;
int ObRow2ExprsProjector::init(
const sql::ObExprPtrIArray& exprs, sql::ObEvalCtx& eval_ctx, const common::ObIArray<int32_t>& projector)
const sql::ObExprPtrIArray &exprs, sql::ObEvalCtx &eval_ctx, const common::ObIArray<int32_t> &projector)
{
int ret = OB_SUCCESS;
if (outputs_.empty()) { // not inited
// first traverse, treat MapConvert::start_ as count
for (int64_t i = 0; i < exprs.count(); i++) {
sql::ObExpr* e = exprs.at(i);
sql::ObExpr *e = exprs.at(i);
// output should always be T_COLUMN_REF, only virtual column has argument.
if (e->arg_cnt_ > 0) {
has_virtual_ = true;
......@@ -60,7 +61,7 @@ int ObRow2ExprsProjector::init(
int64_t other_end = other_idx_;
// second traverse, setup MapConvert::end_ && outputs_
for (int64_t i = 0; i < exprs.count(); i++) {
sql::ObExpr* e = exprs.at(i);
sql::ObExpr *e = exprs.at(i);
const int32_t obj_idx = projector.at(i);
int64_t item_idx = 0;
if (e->arg_cnt_ == 0 && obj_idx >= 0) {
......@@ -77,7 +78,7 @@ int ObRow2ExprsProjector::init(
} else {
item_idx = other_end++;
}
Item& item = outputs_[item_idx];
Item &item = outputs_[item_idx];
item.obj_idx_ = obj_idx;
item.expr_idx_ = i;
item.datum_ = &e->locate_datum_for_write(eval_ctx);
......@@ -90,7 +91,7 @@ int ObRow2ExprsProjector::init(
};
int ObRow2ExprsProjector::project(
const sql::ObExprPtrIArray& exprs, const common::ObObj* cells, int16_t* nop_pos, int64_t& nop_cnt)
const sql::ObExprPtrIArray &exprs, const common::ObObj *cells, int16_t *nop_pos, int64_t &nop_cnt)
{
// performance critical, no parameter validity check.
int ret = OB_SUCCESS;
......@@ -99,8 +100,8 @@ int ObRow2ExprsProjector::project(
int_.project(outputs_.get_data(), cells, nop_pos, nop_cnt);
for (int64_t i = other_idx_; OB_SUCC(ret) && i < outputs_.count(); i++) {
const Item& item = outputs_.at(i);
const ObObj* cell = NULL;
const Item &item = outputs_.at(i);
const ObObj *cell = NULL;
if (OB_UNLIKELY(item.obj_idx_ < 0 || (cell = &cells[item.obj_idx_])->is_nop_value()) || (cell->is_urowid())) {
// need to calc urowid col every time. otherwise may get old value.
nop_pos[nop_cnt++] = item.expr_idx_;
......@@ -128,7 +129,7 @@ int ObTableScanParam::init_rowkey_column_orders()
{
int ret = OB_SUCCESS;
int64_t rowkey_count = 0;
void* buf = NULL;
void *buf = NULL;
if (!is_valid() || OB_NOT_NULL(column_orders_)) {
ret = OB_INVALID_ARGUMENT;
......@@ -141,7 +142,7 @@ int ObTableScanParam::init_rowkey_column_orders()
ret = OB_ALLOCATE_MEMORY_FAILED;
STORAGE_LOG(WARN, "Failed to alloc memrory", K(ret));
} else {
const common::ObIArray<ObColumnParam*>& rowkey_columns =
const common::ObIArray<ObColumnParam *> &rowkey_columns =
scan_flag_.is_index_back() ? table_param_->get_index_columns() : table_param_->get_columns();
rowkey_count =
scan_flag_.is_index_back() ? table_param_->get_index_rowkey_cnt() : table_param_->get_main_rowkey_cnt();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册