fix table location memory leak
This commit is contained in:
		| @ -335,8 +335,9 @@ int ObTaskExecutorCtxUtil::get_part_runner_server( | ||||
|   return ret; | ||||
| } | ||||
|  | ||||
| int ObTaskExecutorCtxUtil::get_full_table_phy_table_location(ObExecContext& ctx, uint64_t table_location_key, | ||||
|     uint64_t ref_table_id, bool is_weak, const ObPhyTableLocation*& table_location) | ||||
| // 每次调用都会 allocate 一个 table_location | ||||
| int ObTaskExecutorCtxUtil::get_full_table_phy_table_location(ObExecContext &ctx, uint64_t table_location_key, | ||||
|     uint64_t ref_table_id, bool is_weak, ObPhyTableLocationGuard &table_location) | ||||
| { | ||||
|   int ret = OB_SUCCESS; | ||||
|   ObPhyTableLocationInfo phy_location_info; | ||||
| @ -348,9 +349,6 @@ int ObTaskExecutorCtxUtil::get_full_table_phy_table_location(ObExecContext& ctx, | ||||
|   const ObTableSchema* table_schema = NULL; | ||||
|   const uint64_t tenant_id = extract_tenant_id(ref_table_id); | ||||
|   // ObPhysicalPlanCtx *plan_ctx = ctx.get_physical_plan_ctx(); | ||||
|   ObPhyTableLocation* loc = nullptr; | ||||
|   table_location = NULL; | ||||
|  | ||||
|   if (OB_ISNULL(location_cache) || OB_ISNULL(schema_service)) { | ||||
|     ret = OB_ERR_UNEXPECTED; | ||||
|     LOG_WARN("location cache or schema_service is null", KP(location_cache), KP(schema_service), K(ret)); | ||||
| @ -380,18 +378,13 @@ int ObTaskExecutorCtxUtil::get_full_table_phy_table_location(ObExecContext& ctx, | ||||
|  | ||||
|   if (OB_FAIL(ret)) { | ||||
|     // bypass | ||||
|   } else if (NULL == (loc = static_cast<ObPhyTableLocation*>(ctx.get_allocator().alloc(sizeof(ObPhyTableLocation))))) { | ||||
|     ret = OB_ALLOCATE_MEMORY_FAILED; | ||||
|   } else if (NULL == (loc = new (loc) ObPhyTableLocation())) { | ||||
|     ret = OB_ERR_UNEXPECTED; | ||||
|     LOG_WARN("fail new object", K(ret)); | ||||
|   } else if (OB_FAIL(ObTableLocation::get_phy_table_location_info( | ||||
|                  ctx, table_location_key, ref_table_id, is_weak, part_ids, *location_cache, phy_location_info))) { | ||||
|     LOG_WARN("get phy table location info failed", K(ret)); | ||||
|   } else if (OB_FAIL(loc->add_partition_locations(phy_location_info))) { | ||||
|   } else if (OB_FAIL(table_location.new_location(ctx.get_allocator()))) { | ||||
|     LOG_WARN("fail alloc new location", K(ret)); | ||||
|   } else if (OB_FAIL(table_location.get_loc()->add_partition_locations(phy_location_info))) { | ||||
|     LOG_WARN("add partition locations failed", K(ret), K(phy_location_info)); | ||||
|   } else { | ||||
|     table_location = loc; | ||||
|   } | ||||
|   return ret; | ||||
| } | ||||
|  | ||||
| @ -310,8 +310,8 @@ public: | ||||
|       ObTaskExecutorCtx& ctx, uint64_t table_location_key, uint64_t ref_table_id, ObPhyTableLocation*& table_location); | ||||
|   static ObPhyTableLocation* get_phy_table_location_for_update( | ||||
|       ObTaskExecutorCtx& ctx, uint64_t table_location_key, uint64_t ref_table_id); | ||||
|   static int get_full_table_phy_table_location(ObExecContext& ctx, uint64_t table_location_key, uint64_t ref_table_id, | ||||
|       bool is_weak, const ObPhyTableLocation*& table_location); | ||||
|   static int get_full_table_phy_table_location(ObExecContext &ctx, uint64_t table_location_key, uint64_t ref_table_id, | ||||
|       bool is_weak, ObPhyTableLocationGuard &table_location); | ||||
|  | ||||
|   static int extract_server_participants( | ||||
|       ObExecContext& ctx, const common::ObAddr& svr, common::ObPartitionIArray& participants); | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 raywill
					raywill