[CP] fix tmp table core

This commit is contained in:
SevenJ-swj 2023-07-21 03:12:47 +00:00 committed by ob-robot
parent f47b3587de
commit c5deec2236
3 changed files with 33 additions and 3 deletions

View File

@ -19774,7 +19774,6 @@ int ObDDLService::collect_temporary_tables_in_session(const ObDropTableArg &cons
} else if (need_collect) {
found = true; // session_id should not across tenant
database_schema = NULL;
table_item.table_name_ = table_schema->get_table_name_str();
table_item.mode_ = table_schema->get_name_case_mode();
if (OB_FAIL(schema_guard.get_database_schema(*tenant_id, table_schema->get_database_id(), database_schema))) {
LOG_WARN("failed to get database schema", K(ret), "tenant_id", tenant_id);
@ -19783,8 +19782,11 @@ int ObDDLService::collect_temporary_tables_in_session(const ObDropTableArg &cons
LOG_WARN("database schema is null", K(ret));
} else if (database_schema->is_in_recyclebin() || table_schema->is_in_recyclebin()) {
LOG_INFO("skip table schema in recyclebin", K(*table_schema));
} else if (FALSE_IT(table_item.database_name_ = database_schema->get_database_name_str())) {
//impossible
} else if (OB_FAIL(ob_write_string(drop_table_arg.allocator_, database_schema->get_database_name_str(),
table_item.database_name_))
|| OB_FAIL(ob_write_string(drop_table_arg.allocator_, table_schema->get_table_name_str(),
table_item.table_name_))) {
LOG_WARN("Can not malloc space for table/db name", K(ret));
} else if (OB_FAIL(drop_table_arg.tables_.push_back(table_item))) {
LOG_WARN("failed to add table item!", K(table_item), K(ret));
} else {

View File

@ -2336,6 +2336,31 @@ bool ObDropTableArg::is_valid() const
return ret;
}
int ObDropTableArg::assign(const ObDropTableArg &other)
{
int ret = OB_SUCCESS;
if (this == &other) {
//do nothing
} else if (OB_FAIL(ObDDLArg::assign(other))) {
LOG_WARN("assign failed", K(ret));
} else {
tenant_id_ = other.tenant_id_;
session_id_ = other.session_id_;
sess_create_time_ = other.sess_create_time_;
table_type_ = other.table_type_;
if_exist_ = other.if_exist_;
to_recyclebin_ = other.to_recyclebin_;
for (int64_t i = 0; OB_SUCC(ret) && i < other.tables_.count(); i++) {
ObTableItem table_item;
table_item.mode_ = other.tables_.at(i).mode_;
OZ (ob_write_string(allocator_, other.tables_.at(i).table_name_, table_item.table_name_));
OZ (ob_write_string(allocator_, other.tables_.at(i).database_name_, table_item.database_name_));
OZ (tables_.push_back(table_item));
}
}
return ret;
}
DEF_TO_STRING(ObDropTableArg)
{
int64_t pos = 0;

View File

@ -2119,6 +2119,8 @@ public:
ObDropTableArg(const ObDropTableArg &other) = delete;
virtual ~ObDropTableArg() { tables_.reset(); }
virtual bool is_allow_when_upgrade() const { return true; }
int assign(const ObDropTableArg& other);
DECLARE_TO_STRING;
uint64_t tenant_id_;
@ -2132,6 +2134,7 @@ public:
bool is_add_to_scheduler_;
bool force_drop_;
lib::Worker::CompatMode compat_mode_;
common::ObArenaAllocator allocator_;
};
struct ObOptimizeTableArg : public ObDDLArg