patch 4.0
This commit is contained in:
95
src/sql/executor/ob_maintain_dependency_info_task.h
Normal file
95
src/sql/executor/ob_maintain_dependency_info_task.h
Normal file
@ -0,0 +1,95 @@
|
||||
/**
|
||||
* Copyright (c) 2021 OceanBase
|
||||
* OceanBase CE is licensed under Mulan PubL v2.
|
||||
* You can use this software according to the terms and conditions of the Mulan PubL v2.
|
||||
* You may obtain a copy of Mulan PubL v2 at:
|
||||
* http://license.coscl.org.cn/MulanPubL-2.0
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
* See the Mulan PubL v2 for more details.
|
||||
*/
|
||||
|
||||
#ifndef OCEANBASE_SQL_EXECUTOR_MAINTAIN_DEPENDENCY_INFO_TASK_
|
||||
#define OCEANBASE_SQL_EXECUTOR_MAINTAIN_DEPENDENCY_INFO_TASK_
|
||||
|
||||
#include "lib/container/ob_fixed_array.h"
|
||||
#include "lib/thread/ob_async_task_queue.h"
|
||||
#include "share/schema/ob_dependency_info.h"
|
||||
namespace oceanbase
|
||||
{
|
||||
|
||||
namespace observer
|
||||
{
|
||||
class ObGlobalContext;
|
||||
}
|
||||
|
||||
namespace sql
|
||||
{
|
||||
class ObMaintainObjDepInfoTask : public share::ObAsyncTask
|
||||
{
|
||||
public:
|
||||
typedef share::schema::ObReferenceObjTable::DependencyObjKeyItemPair DepObjKeyItem;
|
||||
typedef share::schema::ObReferenceObjTable::DependencyObjKeyItemPairs DepObjKeyItemList;
|
||||
ObMaintainObjDepInfoTask (
|
||||
const uint64_t tenant_id);
|
||||
ObMaintainObjDepInfoTask (
|
||||
uint64_t tenant_id,
|
||||
obrpc::ObCommonRpcProxy &rs_rpc_proxy,
|
||||
const DepObjKeyItemList &insert_dep_objs,
|
||||
const DepObjKeyItemList &update_dep_objs,
|
||||
const DepObjKeyItemList &delete_dep_objs);
|
||||
virtual ~ObMaintainObjDepInfoTask()
|
||||
{
|
||||
insert_dep_objs_.destroy();
|
||||
update_dep_objs_.destroy();
|
||||
delete_dep_objs_.destroy();
|
||||
}
|
||||
DepObjKeyItemList& get_insert_dep_objs() { return insert_dep_objs_; }
|
||||
DepObjKeyItemList& get_update_dep_objs() { return update_dep_objs_; }
|
||||
DepObjKeyItemList& get_delete_dep_objs() { return delete_dep_objs_; }
|
||||
bool is_empty_task() const
|
||||
{ return insert_dep_objs_.empty() && update_dep_objs_.empty() && delete_dep_objs_.empty(); }
|
||||
// int check_and_refresh_schema(uint64_t effective_tenant_id);
|
||||
int check_cur_maintain_task_is_valid(
|
||||
const share::schema::ObReferenceObjTable::ObDependencyObjKey &dep_obj_key,
|
||||
int64_t dep_obj_schema_version,
|
||||
share::schema::ObSchemaGetterGuard &schema_guard,
|
||||
bool &is_valid);
|
||||
int check_and_build_dep_info_arg(
|
||||
share::schema::ObSchemaGetterGuard &schema_guard,
|
||||
obrpc::ObDependencyObjDDLArg &dep_obj_info_arg,
|
||||
const common::ObIArray<DepObjKeyItem> &dep_objs,
|
||||
share::schema::ObReferenceObjTable::ObSchemaRefObjOp op);
|
||||
|
||||
virtual int process() override;
|
||||
virtual int64_t get_deep_copy_size() const override { return sizeof(ObMaintainObjDepInfoTask); }
|
||||
ObAsyncTask *deep_copy(char *buf, const int64_t buf_size) const override;
|
||||
|
||||
private:
|
||||
uint64_t tenant_id_;
|
||||
const observer::ObGlobalContext &gctx_;
|
||||
obrpc::ObCommonRpcProxy &rs_rpc_proxy_;
|
||||
DepObjKeyItemList insert_dep_objs_;
|
||||
DepObjKeyItemList update_dep_objs_;
|
||||
DepObjKeyItemList delete_dep_objs_;
|
||||
DISALLOW_COPY_AND_ASSIGN(ObMaintainObjDepInfoTask);
|
||||
};
|
||||
|
||||
class ObMaintainDepInfoTaskQueue: public share::ObAsyncTaskQueue
|
||||
{
|
||||
public:
|
||||
ObMaintainDepInfoTaskQueue() : last_execute_time_(0) {}
|
||||
virtual ~ObMaintainDepInfoTaskQueue() {}
|
||||
virtual void run2() override;
|
||||
inline int64_t get_last_execute_time() const { return last_execute_time_; }
|
||||
inline void set_last_execute_time(const int64_t execute_time)
|
||||
{ last_execute_time_ = execute_time; }
|
||||
|
||||
private:
|
||||
int64_t last_execute_time_;
|
||||
};
|
||||
|
||||
} // namespace sql
|
||||
} // namespace oceanbase
|
||||
#endif /* OCEANBASE_SQL_EXECUTOR_MAINTAIN_DEPENDENCY_INFO_TASK_ */
|
||||
Reference in New Issue
Block a user