From b8fce5f1706b5f8c25c6e97ee05e3f2bb12abb6d Mon Sep 17 00:00:00 2001 From: obdev Date: Wed, 8 Nov 2023 08:39:19 +0000 Subject: [PATCH] fix shallow copy of string in restore table arg. --- .../restore/ob_import_table_job_scheduler.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/rootserver/restore/ob_import_table_job_scheduler.cpp b/src/rootserver/restore/ob_import_table_job_scheduler.cpp index a1ebb2ed9..cf4cfdd42 100644 --- a/src/rootserver/restore/ob_import_table_job_scheduler.cpp +++ b/src/rootserver/restore/ob_import_table_job_scheduler.cpp @@ -706,12 +706,15 @@ int ObImportTableTaskScheduler::construct_import_table_arg_(obrpc::ObRecoverRest LOG_WARN("fail to get tenant system variable", K(ret)); } else if (OB_ISNULL(data_format_schema) || OB_ISNULL(nls_timestamp_format) || OB_ISNULL(nls_timestamp_tz_format)) { ret = OB_ERR_UNEXPECTED; - LOG_WARN("var schema must not be null", K(ret)); + LOG_WARN("var schema must not be null", K(ret), KP(data_format_schema), KP(nls_timestamp_format), KP(nls_timestamp_tz_format)); + } else if (OB_FAIL(ob_write_string(arg.allocator_, data_format_schema->get_value(), arg.nls_formats_[ObNLSFormatEnum::NLS_DATE]))) { + LOG_WARN("deep copy failed", K(ret), K(data_format_schema->get_value())); + } else if (OB_FAIL(ob_write_string(arg.allocator_, nls_timestamp_format->get_value(), arg.nls_formats_[ObNLSFormatEnum::NLS_TIMESTAMP]))) { + LOG_WARN("deep copy failed", K(ret), K(nls_timestamp_format->get_value())); + } else if (OB_FAIL(ob_write_string(arg.allocator_, nls_timestamp_tz_format->get_value(), arg.nls_formats_[ObNLSFormatEnum::NLS_TIMESTAMP_TZ]))) { + LOG_WARN("deep copy failed", K(ret), K(nls_timestamp_tz_format->get_value())); } else { arg.tz_info_ = arg.tz_info_wrap_.get_tz_info_offset(); - arg.nls_formats_[ObNLSFormatEnum::NLS_DATE] = data_format_schema->get_value(); - arg.nls_formats_[ObNLSFormatEnum::NLS_TIMESTAMP] = nls_timestamp_format->get_value(); - arg.nls_formats_[ObNLSFormatEnum::NLS_TIMESTAMP_TZ] = nls_timestamp_tz_format->get_value(); } } return ret;