Add log_user_error for direct_load

This commit is contained in:
coolfishchen
2023-09-18 07:44:15 +00:00
committed by ob-robot
parent 98f8d4dd13
commit 36b219a97f
6 changed files with 44 additions and 10 deletions

View File

@ -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()) {
ret = OB_NOT_SUPPORTED;
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
else if (table_schema->is_view_table()) {
ret = OB_NOT_SUPPORTED;
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
else if (OB_UNLIKELY(table_schema->has_generated_column())) {
ret = OB_NOT_SUPPORTED;
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
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) {
ret = OB_NOT_SUPPORTED;
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
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) {
ret = OB_NOT_SUPPORTED;
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;

View File

@ -199,6 +199,15 @@ void ObTableLoadTaskThreadPoolScheduler::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()
@ -211,6 +220,13 @@ void ObTableLoadTaskThreadPoolScheduler::after_running()
{
state_ = STATE_STOPPED;
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)

View File

@ -18,6 +18,7 @@
#include "lib/queue/ob_lighty_queue.h"
#include "share/ob_thread_pool.h"
#include "lib/allocator/page_arena.h"
#include "lib/oblog/ob_warning_buffer.h"
namespace oceanbase
{
@ -105,6 +106,8 @@ private:
volatile int state_;
bool is_inited_;
lib::ObMutex state_mutex_;
common::ObWarningBuffer warning_buffer_;
lib::ObMutex wb_mutex_;
};
} // namespace observer

View File

@ -279,6 +279,7 @@ int ObTableLoadTransBucketWriter::handle_identity_column(const ObColumnSchemaV2
if (column_schema->is_always_identity_column()) {
ret = OB_NOT_SUPPORTED;
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()) {
ret = OB_ERR_INVALID_NOT_NULL_CONSTRAINT_ON_IDENTITY_COLUMN;
LOG_WARN("default identity column has null value", KR(ret));

View File

@ -455,6 +455,7 @@ int ObTableLoadTransStoreWriter::handle_identity_column(const ObColumnSchemaV2 *
if (column_schema->is_always_identity_column()) {
ret = OB_NOT_SUPPORTED;
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()) {
ret = OB_ERR_INVALID_NOT_NULL_CONSTRAINT_ON_IDENTITY_COLUMN;
LOG_WARN("default identity column has null value", KR(ret));

View File

@ -380,6 +380,7 @@ int ObLoadDataDirectImpl::SequentialDataAccessor::init(const DataAccessParam &da
} else {
ret = OB_NOT_SUPPORTED;
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)) {
is_inited_ = true;
@ -726,6 +727,7 @@ int ObLoadDataDirectImpl::DataReader::get_next_buffer(ObLoadFileBuffer &file_buf
ret = OB_NOT_SUPPORTED;
LOG_WARN("direct-load does not support big row", KR(ret), "size",
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))) {
LOG_WARN("fail to back up data", KR(ret));
} else {
@ -1630,6 +1632,7 @@ int ObLoadDataDirectImpl::MultiFilesLoadTaskProcessor::process()
ret = OB_NOT_SUPPORTED;
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_));
FORWARD_USER_ERROR_MSG(ret, "direct-load does not support ignore rows exceed the first file");
} else if (!handle_->data_buffer_.empty()) {
handle_->data_buffer_.is_end_file_ = data_reader_.is_end_file();
handle_->start_line_no_ = handle_->result_.parsed_row_count_ + 1;
@ -1665,6 +1668,7 @@ int ObLoadDataDirectImpl::MultiFilesLoadTaskProcessor::process()
ret = OB_NOT_SUPPORTED;
LOG_WARN("direct-load does not support big row", KR(ret), "size",
handle_->data_buffer_.get_data_length());
FORWARD_USER_ERROR_MSG(ret, "direct-load does not support big row");
} else {
total_line_count += current_line_count;
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;
LOG_WARN("direct-load does not support big row", KR(ret), "size",
data_buffer.get_data_length());
FORWARD_USER_ERROR_MSG(ret, "direct-load does not support big row");
} else {
data_buffer.advance(complete_len);
skip_line_count += complete_cnt;
@ -1852,6 +1857,7 @@ int ObLoadDataDirectImpl::execute(ObExecContext &ctx, ObLoadDataStmt &load_stmt)
}
}
if (OB_SUCC(ret)) {
if (OB_FAIL(init_execute_param())) {
LOG_WARN("fail to init execute param", KR(ret), K(ctx), K(load_stmt));
} else if (OB_FAIL(init_execute_context())) {
@ -1863,6 +1869,7 @@ int ObLoadDataDirectImpl::execute(ObExecContext &ctx, ObLoadDataStmt &load_stmt)
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)) {
FileLoadExecutor *file_load_executor = nullptr;
@ -2107,6 +2114,7 @@ int ObLoadDataDirectImpl::init_store_column_idxs(ObIArray<int64_t> &store_column
ret = OB_NOT_SUPPORTED;
LOG_WARN("not supported incomplete column data", KR(ret), K(store_column_idxs),
K(column_descs), K(field_or_var_list));
FORWARD_USER_ERROR_MSG(ret, "not supported incomplete column data");
}
}
return ret;