Plan Cache adds tracepoint and throws an error code when it fails.
This commit is contained in:
		
							
								
								
									
										1
									
								
								deps/oblib/src/lib/utility/ob_tracepoint.h
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								deps/oblib/src/lib/utility/ob_tracepoint.h
									
									
									
									
										vendored
									
									
								
							| @ -754,6 +754,7 @@ class EventTable | |||||||
|       // sql parameterization 1170-1180 |       // sql parameterization 1170-1180 | ||||||
|       EN_SQL_PARAM_FP_NP_NOT_SAME_ERROR = 1170, |       EN_SQL_PARAM_FP_NP_NOT_SAME_ERROR = 1170, | ||||||
|       EN_FLUSH_PC_NOT_CLEANUP_LEAK_MEM_ERROR = 1171, |       EN_FLUSH_PC_NOT_CLEANUP_LEAK_MEM_ERROR = 1171, | ||||||
|  |       EN_PC_NOT_SWALLOW_ERROR = 1172, | ||||||
|       // END OF sql parameterization 1170-1180 |       // END OF sql parameterization 1170-1180 | ||||||
|  |  | ||||||
|       // session info verification |       // session info verification | ||||||
|  | |||||||
| @ -3855,7 +3855,16 @@ int ObSql::pc_get_plan(ObPlanCacheCtx &pc_ctx, | |||||||
|       //inner sql不能丢入大查询队列, 因为有可能上层查询已有数据返回客户端 |       //inner sql不能丢入大查询队列, 因为有可能上层查询已有数据返回客户端 | ||||||
|     } else { |     } else { | ||||||
|       get_plan_err = ret; |       get_plan_err = ret; | ||||||
|       ret = OB_SUCCESS; //get plan出错, 覆盖错误码, 确保因plan cache的错误不影响正常执行路径 |       int tmp_ret = OB_SUCCESS; | ||||||
|  |       tmp_ret = OB_E(EventTable::EN_PC_NOT_SWALLOW_ERROR) OB_SUCCESS; | ||||||
|  |       if (OB_SUCCESS != tmp_ret) { | ||||||
|  |          // do nothing | ||||||
|  |         if (OB_SQL_PC_NOT_EXIST == ret) { | ||||||
|  |           ret = OB_SUCCESS; | ||||||
|  |         } | ||||||
|  |       } else { | ||||||
|  |         ret = OB_SUCCESS; //get plan出错, 覆盖错误码, 确保因plan cache的错误不影响正常执行路径 | ||||||
|  |       } | ||||||
|     } |     } | ||||||
|   } else { //get plan 成功 |   } else { //get plan 成功 | ||||||
|     plan_cache->inc_hit_and_access_cnt(); |     plan_cache->inc_hit_and_access_cnt(); | ||||||
| @ -4340,6 +4349,8 @@ int ObSql::pc_add_plan(ObPlanCacheCtx &pc_ctx, | |||||||
|       ret = OB_REACH_MAX_CONCURRENT_NUM; |       ret = OB_REACH_MAX_CONCURRENT_NUM; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     int tmp_ret = OB_SUCCESS; | ||||||
|  |     tmp_ret = OB_E(EventTable::EN_PC_NOT_SWALLOW_ERROR) OB_SUCCESS; | ||||||
|     if (is_batch_exec) { |     if (is_batch_exec) { | ||||||
|       // Batch optimization cannot continue for errors other than OB_SQL_PC_PLAN_DUPLICATE. |       // Batch optimization cannot continue for errors other than OB_SQL_PC_PLAN_DUPLICATE. | ||||||
|       if (OB_SQL_PC_PLAN_DUPLICATE == ret) { |       if (OB_SQL_PC_PLAN_DUPLICATE == ret) { | ||||||
| @ -4367,9 +4378,13 @@ int ObSql::pc_add_plan(ObPlanCacheCtx &pc_ctx, | |||||||
|       ret = OB_SUCCESS; |       ret = OB_SUCCESS; | ||||||
|       LOG_DEBUG("plan cache don't support add this kind of plan now",  K(phy_plan)); |       LOG_DEBUG("plan cache don't support add this kind of plan now",  K(phy_plan)); | ||||||
|     } else if (OB_FAIL(ret)) { |     } else if (OB_FAIL(ret)) { | ||||||
|       if (OB_REACH_MAX_CONCURRENT_NUM != ret) { //如果是达到限流上限, 则将错误码抛出去 |       if (OB_SUCCESS != tmp_ret) { | ||||||
|         ret = OB_SUCCESS; //add plan出错, 覆盖错误码, 确保因plan cache失败不影响正常执行路径 |  | ||||||
|         LOG_WARN("Failed to add plan to ObPlanCache", K(ret)); |       } else { | ||||||
|  |         if (OB_REACH_MAX_CONCURRENT_NUM != ret) { //如果是达到限流上限, 则将错误码抛出去 | ||||||
|  |           ret = OB_SUCCESS; //add plan出错, 覆盖错误码, 确保因plan cache失败不影响正常执行路径 | ||||||
|  |           LOG_WARN("Failed to add plan to ObPlanCache", K(ret)); | ||||||
|  |         } | ||||||
|       } |       } | ||||||
|     } else { |     } else { | ||||||
|       pc_ctx.sql_ctx_.self_add_plan_ = true; |       pc_ctx.sql_ctx_.self_add_plan_ = true; | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 obdev
					obdev