Add log_user_error for direct_load
This commit is contained in:
@ -308,16 +308,19 @@ int ObTableLoadService::check_support_direct_load(uint64_t table_id)
|
|||||||
else if (lib::is_oracle_mode() && table_schema->is_tmp_table()) {
|
else if (lib::is_oracle_mode() && table_schema->is_tmp_table()) {
|
||||||
ret = OB_NOT_SUPPORTED;
|
ret = OB_NOT_SUPPORTED;
|
||||||
LOG_WARN("direct-load does not support oracle temporary table", KR(ret));
|
LOG_WARN("direct-load does not support oracle temporary table", KR(ret));
|
||||||
|
FORWARD_USER_ERROR_MSG(ret, "direct-load does not support oracle temporary table");
|
||||||
}
|
}
|
||||||
// check if it is a view
|
// check if it is a view
|
||||||
else if (table_schema->is_view_table()) {
|
else if (table_schema->is_view_table()) {
|
||||||
ret = OB_NOT_SUPPORTED;
|
ret = OB_NOT_SUPPORTED;
|
||||||
LOG_WARN("direct-load does not support view table", KR(ret));
|
LOG_WARN("direct-load does not support view table", KR(ret));
|
||||||
|
FORWARD_USER_ERROR_MSG(ret, "direct-load does not support view table");
|
||||||
}
|
}
|
||||||
// check if exists generated column
|
// check if exists generated column
|
||||||
else if (OB_UNLIKELY(table_schema->has_generated_column())) {
|
else if (OB_UNLIKELY(table_schema->has_generated_column())) {
|
||||||
ret = OB_NOT_SUPPORTED;
|
ret = OB_NOT_SUPPORTED;
|
||||||
LOG_WARN("direct-load does not support table has generated column", KR(ret));
|
LOG_WARN("direct-load does not support table has generated column", KR(ret));
|
||||||
|
FORWARD_USER_ERROR_MSG(ret, "direct-load does not support table has generated column");
|
||||||
}
|
}
|
||||||
// check if the trigger is enabled
|
// check if the trigger is enabled
|
||||||
else if (OB_FAIL(table_schema->check_has_trigger_on_table(schema_guard, trigger_enabled))) {
|
else if (OB_FAIL(table_schema->check_has_trigger_on_table(schema_guard, trigger_enabled))) {
|
||||||
@ -325,6 +328,7 @@ int ObTableLoadService::check_support_direct_load(uint64_t table_id)
|
|||||||
} else if (trigger_enabled) {
|
} else if (trigger_enabled) {
|
||||||
ret = OB_NOT_SUPPORTED;
|
ret = OB_NOT_SUPPORTED;
|
||||||
LOG_WARN("direct-load does not support table with trigger enabled", KR(ret), K(trigger_enabled));
|
LOG_WARN("direct-load does not support table with trigger enabled", KR(ret), K(trigger_enabled));
|
||||||
|
FORWARD_USER_ERROR_MSG(ret, "direct-load does not support table with trigger enabled");
|
||||||
}
|
}
|
||||||
// check has udt column
|
// check has udt column
|
||||||
else if (OB_FAIL(ObTableLoadSchema::check_has_udt_column(table_schema, has_udt_column))) {
|
else if (OB_FAIL(ObTableLoadSchema::check_has_udt_column(table_schema, has_udt_column))) {
|
||||||
@ -332,6 +336,7 @@ int ObTableLoadService::check_support_direct_load(uint64_t table_id)
|
|||||||
} else if (has_udt_column) {
|
} else if (has_udt_column) {
|
||||||
ret = OB_NOT_SUPPORTED;
|
ret = OB_NOT_SUPPORTED;
|
||||||
LOG_WARN("direct-load does not support table has udt column", KR(ret));
|
LOG_WARN("direct-load does not support table has udt column", KR(ret));
|
||||||
|
FORWARD_USER_ERROR_MSG(ret, "direct-load does not support table has udt column");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
@ -199,6 +199,15 @@ void ObTableLoadTaskThreadPoolScheduler::wait()
|
|||||||
thread_pool_.wait();
|
thread_pool_.wait();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < warning_buffer_.get_total_warning_count(); ++i) {
|
||||||
|
const common::ObWarningBuffer::WarningItem &warning_item = *(warning_buffer_.get_warning_item(i));
|
||||||
|
if (ObLogger::USER_WARN == warning_item.log_level_) {
|
||||||
|
FORWARD_USER_WARN(warning_item.code_, warning_item.msg_);
|
||||||
|
} else if (ObLogger::USER_NOTE == warning_item.log_level_) {
|
||||||
|
FORWARD_USER_NOTE(warning_item.code_, warning_item.msg_);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObTableLoadTaskThreadPoolScheduler::before_running()
|
void ObTableLoadTaskThreadPoolScheduler::before_running()
|
||||||
@ -211,6 +220,13 @@ void ObTableLoadTaskThreadPoolScheduler::after_running()
|
|||||||
{
|
{
|
||||||
state_ = STATE_STOPPED;
|
state_ = STATE_STOPPED;
|
||||||
clear_all_task();
|
clear_all_task();
|
||||||
|
const ObWarningBuffer *wb = common::ob_get_tsi_warning_buffer();
|
||||||
|
if (wb != nullptr) {
|
||||||
|
if (wb->get_total_warning_count() > 0) {
|
||||||
|
lib::ObMutexGuard guard(wb_mutex_);
|
||||||
|
warning_buffer_ = *wb;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObTableLoadTaskThreadPoolScheduler::run(uint64_t thread_idx)
|
void ObTableLoadTaskThreadPoolScheduler::run(uint64_t thread_idx)
|
||||||
|
|||||||
@ -18,6 +18,7 @@
|
|||||||
#include "lib/queue/ob_lighty_queue.h"
|
#include "lib/queue/ob_lighty_queue.h"
|
||||||
#include "share/ob_thread_pool.h"
|
#include "share/ob_thread_pool.h"
|
||||||
#include "lib/allocator/page_arena.h"
|
#include "lib/allocator/page_arena.h"
|
||||||
|
#include "lib/oblog/ob_warning_buffer.h"
|
||||||
|
|
||||||
namespace oceanbase
|
namespace oceanbase
|
||||||
{
|
{
|
||||||
@ -105,6 +106,8 @@ private:
|
|||||||
volatile int state_;
|
volatile int state_;
|
||||||
bool is_inited_;
|
bool is_inited_;
|
||||||
lib::ObMutex state_mutex_;
|
lib::ObMutex state_mutex_;
|
||||||
|
common::ObWarningBuffer warning_buffer_;
|
||||||
|
lib::ObMutex wb_mutex_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace observer
|
} // namespace observer
|
||||||
|
|||||||
@ -279,6 +279,7 @@ int ObTableLoadTransBucketWriter::handle_identity_column(const ObColumnSchemaV2
|
|||||||
if (column_schema->is_always_identity_column()) {
|
if (column_schema->is_always_identity_column()) {
|
||||||
ret = OB_NOT_SUPPORTED;
|
ret = OB_NOT_SUPPORTED;
|
||||||
LOG_WARN("direct-load does not support always identity column", KR(ret));
|
LOG_WARN("direct-load does not support always identity column", KR(ret));
|
||||||
|
FORWARD_USER_ERROR_MSG(ret, "direct-load does not support always identity column");
|
||||||
} else if (column_schema->is_default_identity_column() && datum.is_null()) {
|
} else if (column_schema->is_default_identity_column() && datum.is_null()) {
|
||||||
ret = OB_ERR_INVALID_NOT_NULL_CONSTRAINT_ON_IDENTITY_COLUMN;
|
ret = OB_ERR_INVALID_NOT_NULL_CONSTRAINT_ON_IDENTITY_COLUMN;
|
||||||
LOG_WARN("default identity column has null value", KR(ret));
|
LOG_WARN("default identity column has null value", KR(ret));
|
||||||
|
|||||||
@ -455,6 +455,7 @@ int ObTableLoadTransStoreWriter::handle_identity_column(const ObColumnSchemaV2 *
|
|||||||
if (column_schema->is_always_identity_column()) {
|
if (column_schema->is_always_identity_column()) {
|
||||||
ret = OB_NOT_SUPPORTED;
|
ret = OB_NOT_SUPPORTED;
|
||||||
LOG_WARN("direct-load does not support always identity column", KR(ret));
|
LOG_WARN("direct-load does not support always identity column", KR(ret));
|
||||||
|
FORWARD_USER_ERROR_MSG(ret, "direct-load does not support always identity column");
|
||||||
} else if (column_schema->is_default_identity_column() && datum.is_null()) {
|
} else if (column_schema->is_default_identity_column() && datum.is_null()) {
|
||||||
ret = OB_ERR_INVALID_NOT_NULL_CONSTRAINT_ON_IDENTITY_COLUMN;
|
ret = OB_ERR_INVALID_NOT_NULL_CONSTRAINT_ON_IDENTITY_COLUMN;
|
||||||
LOG_WARN("default identity column has null value", KR(ret));
|
LOG_WARN("default identity column has null value", KR(ret));
|
||||||
|
|||||||
@ -380,6 +380,7 @@ int ObLoadDataDirectImpl::SequentialDataAccessor::init(const DataAccessParam &da
|
|||||||
} else {
|
} else {
|
||||||
ret = OB_NOT_SUPPORTED;
|
ret = OB_NOT_SUPPORTED;
|
||||||
LOG_WARN("not supported load file location", KR(ret), K(data_access_param.file_location_));
|
LOG_WARN("not supported load file location", KR(ret), K(data_access_param.file_location_));
|
||||||
|
FORWARD_USER_ERROR_MSG(ret, "not supported load file location");
|
||||||
}
|
}
|
||||||
if (OB_SUCC(ret)) {
|
if (OB_SUCC(ret)) {
|
||||||
is_inited_ = true;
|
is_inited_ = true;
|
||||||
@ -726,6 +727,7 @@ int ObLoadDataDirectImpl::DataReader::get_next_buffer(ObLoadFileBuffer &file_buf
|
|||||||
ret = OB_NOT_SUPPORTED;
|
ret = OB_NOT_SUPPORTED;
|
||||||
LOG_WARN("direct-load does not support big row", KR(ret), "size",
|
LOG_WARN("direct-load does not support big row", KR(ret), "size",
|
||||||
file_buffer.get_data_len());
|
file_buffer.get_data_len());
|
||||||
|
FORWARD_USER_ERROR_MSG(ret, "direct-load does not support big row, row_size = %ld", file_buffer.get_data_len());
|
||||||
} else if (OB_FAIL(data_trimer_.backup_incomplate_data(file_buffer, complete_len))) {
|
} else if (OB_FAIL(data_trimer_.backup_incomplate_data(file_buffer, complete_len))) {
|
||||||
LOG_WARN("fail to back up data", KR(ret));
|
LOG_WARN("fail to back up data", KR(ret));
|
||||||
} else {
|
} else {
|
||||||
@ -1630,6 +1632,7 @@ int ObLoadDataDirectImpl::MultiFilesLoadTaskProcessor::process()
|
|||||||
ret = OB_NOT_SUPPORTED;
|
ret = OB_NOT_SUPPORTED;
|
||||||
LOG_WARN("direct-load does not support ignore rows exceed the first file", KR(ret),
|
LOG_WARN("direct-load does not support ignore rows exceed the first file", KR(ret),
|
||||||
K(current_line_count), K(execute_param_->ignore_row_num_));
|
K(current_line_count), K(execute_param_->ignore_row_num_));
|
||||||
|
FORWARD_USER_ERROR_MSG(ret, "direct-load does not support ignore rows exceed the first file");
|
||||||
} else if (!handle_->data_buffer_.empty()) {
|
} else if (!handle_->data_buffer_.empty()) {
|
||||||
handle_->data_buffer_.is_end_file_ = data_reader_.is_end_file();
|
handle_->data_buffer_.is_end_file_ = data_reader_.is_end_file();
|
||||||
handle_->start_line_no_ = handle_->result_.parsed_row_count_ + 1;
|
handle_->start_line_no_ = handle_->result_.parsed_row_count_ + 1;
|
||||||
@ -1665,6 +1668,7 @@ int ObLoadDataDirectImpl::MultiFilesLoadTaskProcessor::process()
|
|||||||
ret = OB_NOT_SUPPORTED;
|
ret = OB_NOT_SUPPORTED;
|
||||||
LOG_WARN("direct-load does not support big row", KR(ret), "size",
|
LOG_WARN("direct-load does not support big row", KR(ret), "size",
|
||||||
handle_->data_buffer_.get_data_length());
|
handle_->data_buffer_.get_data_length());
|
||||||
|
FORWARD_USER_ERROR_MSG(ret, "direct-load does not support big row");
|
||||||
} else {
|
} else {
|
||||||
total_line_count += current_line_count;
|
total_line_count += current_line_count;
|
||||||
if (OB_UNLIKELY(total_line_count > ObTableLoadSequenceNo::MAX_DATA_SEQ_NO)){
|
if (OB_UNLIKELY(total_line_count > ObTableLoadSequenceNo::MAX_DATA_SEQ_NO)){
|
||||||
@ -1710,6 +1714,7 @@ int ObLoadDataDirectImpl::MultiFilesLoadTaskProcessor::skip_ignore_rows(int64_t
|
|||||||
ret = OB_NOT_SUPPORTED;
|
ret = OB_NOT_SUPPORTED;
|
||||||
LOG_WARN("direct-load does not support big row", KR(ret), "size",
|
LOG_WARN("direct-load does not support big row", KR(ret), "size",
|
||||||
data_buffer.get_data_length());
|
data_buffer.get_data_length());
|
||||||
|
FORWARD_USER_ERROR_MSG(ret, "direct-load does not support big row");
|
||||||
} else {
|
} else {
|
||||||
data_buffer.advance(complete_len);
|
data_buffer.advance(complete_len);
|
||||||
skip_line_count += complete_cnt;
|
skip_line_count += complete_cnt;
|
||||||
@ -1852,16 +1857,18 @@ int ObLoadDataDirectImpl::execute(ObExecContext &ctx, ObLoadDataStmt &load_stmt)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (OB_FAIL(init_execute_param())) {
|
if (OB_SUCC(ret)) {
|
||||||
LOG_WARN("fail to init execute param", KR(ret), K(ctx), K(load_stmt));
|
if (OB_FAIL(init_execute_param())) {
|
||||||
} else if (OB_FAIL(init_execute_context())) {
|
LOG_WARN("fail to init execute param", KR(ret), K(ctx), K(load_stmt));
|
||||||
LOG_WARN("fail to init execute context", KR(ret), K(ctx), K(load_stmt));
|
} else if (OB_FAIL(init_execute_context())) {
|
||||||
} else {
|
LOG_WARN("fail to init execute context", KR(ret), K(ctx), K(load_stmt));
|
||||||
LOG_INFO("LOAD DATA init finish", K_(execute_param), "file_path", load_args.file_name_);
|
} else {
|
||||||
ObLoadDataStat *job_stat = execute_ctx_.job_stat_;
|
LOG_INFO("LOAD DATA init finish", K_(execute_param), "file_path", load_args.file_name_);
|
||||||
OZ(ob_write_string(job_stat->allocator_, load_args.file_name_, job_stat->file_path_));
|
ObLoadDataStat *job_stat = execute_ctx_.job_stat_;
|
||||||
job_stat->file_column_ = execute_param_.data_access_param_.file_column_num_;
|
OZ(ob_write_string(job_stat->allocator_, load_args.file_name_, job_stat->file_path_));
|
||||||
job_stat->load_mode_ = static_cast<int64_t>(execute_param_.dup_action_);
|
job_stat->file_column_ = execute_param_.data_access_param_.file_column_num_;
|
||||||
|
job_stat->load_mode_ = static_cast<int64_t>(execute_param_.dup_action_);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (OB_SUCC(ret)) {
|
if (OB_SUCC(ret)) {
|
||||||
@ -2107,6 +2114,7 @@ int ObLoadDataDirectImpl::init_store_column_idxs(ObIArray<int64_t> &store_column
|
|||||||
ret = OB_NOT_SUPPORTED;
|
ret = OB_NOT_SUPPORTED;
|
||||||
LOG_WARN("not supported incomplete column data", KR(ret), K(store_column_idxs),
|
LOG_WARN("not supported incomplete column data", KR(ret), K(store_column_idxs),
|
||||||
K(column_descs), K(field_or_var_list));
|
K(column_descs), K(field_or_var_list));
|
||||||
|
FORWARD_USER_ERROR_MSG(ret, "not supported incomplete column data");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
Reference in New Issue
Block a user