Fix some plan cache bug
This commit is contained in:
		@ -188,7 +188,7 @@ int ObPLCacheMgr::add_pl_cache(ObPlanCache *lib_cache, ObILibCacheObject *pl_obj
 | 
				
			|||||||
int ObPLCacheMgr::cache_evict_all_pl(ObPlanCache *lib_cache)
 | 
					int ObPLCacheMgr::cache_evict_all_pl(ObPlanCache *lib_cache)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  int ret = OB_SUCCESS;
 | 
					  int ret = OB_SUCCESS;
 | 
				
			||||||
  PL_CACHE_LOG(DEBUG, "cache evict all pl cache start");
 | 
					  PL_CACHE_LOG(TRACE, "cache evict all pl cache start");
 | 
				
			||||||
  if (OB_ISNULL(lib_cache)) {
 | 
					  if (OB_ISNULL(lib_cache)) {
 | 
				
			||||||
    ret = OB_ERR_UNEXPECTED;
 | 
					    ret = OB_ERR_UNEXPECTED;
 | 
				
			||||||
    LOG_WARN("lib cache is null");
 | 
					    LOG_WARN("lib cache is null");
 | 
				
			||||||
@ -198,7 +198,7 @@ int ObPLCacheMgr::cache_evict_all_pl(ObPlanCache *lib_cache)
 | 
				
			|||||||
    if (OB_FAIL(lib_cache->foreach_cache_evict(get_ids_op))) {
 | 
					    if (OB_FAIL(lib_cache->foreach_cache_evict(get_ids_op))) {
 | 
				
			||||||
      PL_CACHE_LOG(WARN, "failed to foreach cache evict", K(ret));
 | 
					      PL_CACHE_LOG(WARN, "failed to foreach cache evict", K(ret));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    PL_CACHE_LOG(DEBUG, "cache evict all pl end", K(to_evict_keys));
 | 
					    PL_CACHE_LOG(TRACE, "cache evict all pl end");
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return ret;
 | 
					  return ret;
 | 
				
			||||||
 | 
				
			|||||||
@ -68,7 +68,7 @@ public:
 | 
				
			|||||||
  public:
 | 
					  public:
 | 
				
			||||||
    ExtraInfo(common::ObIAllocator &alloc, ObExprOperatorType type)
 | 
					    ExtraInfo(common::ObIAllocator &alloc, ObExprOperatorType type)
 | 
				
			||||||
      : ObIExprExtraInfo(alloc, type),
 | 
					      : ObIExprExtraInfo(alloc, type),
 | 
				
			||||||
        is_cursor_(false), row_desc_(alloc) {}
 | 
					        is_cursor_(false), scalar_result_type_(alloc), row_desc_(alloc) {}
 | 
				
			||||||
    virtual ~ExtraInfo() { row_desc_.destroy(); }
 | 
					    virtual ~ExtraInfo() { row_desc_.destroy(); }
 | 
				
			||||||
    void reset();
 | 
					    void reset();
 | 
				
			||||||
    int assign(const ExtraInfo &other);
 | 
					    int assign(const ExtraInfo &other);
 | 
				
			||||||
 | 
				
			|||||||
@ -1063,7 +1063,7 @@ int ObSql::do_real_prepare(const ObString &sql,
 | 
				
			|||||||
              && !(ObStmt::is_dml_write_stmt(stmt_type) && // returning into from oci not supported
 | 
					              && !(ObStmt::is_dml_write_stmt(stmt_type) && // returning into from oci not supported
 | 
				
			||||||
                   static_cast<ObDelUpdStmt*>(basic_stmt)->get_returning_into_exprs().count() > 0)
 | 
					                   static_cast<ObDelUpdStmt*>(basic_stmt)->get_returning_into_exprs().count() > 0)
 | 
				
			||||||
              && enable_udr
 | 
					              && enable_udr
 | 
				
			||||||
              && OB_FAIL(ObUDRUtils::match_udr_item(sql, session, allocator, item_guard))) {
 | 
					              && OB_FAIL(ObUDRUtils::match_udr_item(sql, session, ectx, allocator, item_guard))) {
 | 
				
			||||||
      if (!ObSQLUtils::check_need_disconnect_parser_err(ret)) {
 | 
					      if (!ObSQLUtils::check_need_disconnect_parser_err(ret)) {
 | 
				
			||||||
        ectx.set_need_disconnect(false);
 | 
					        ectx.set_need_disconnect(false);
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
@ -1083,7 +1083,7 @@ int ObSql::do_real_prepare(const ObString &sql,
 | 
				
			|||||||
                                                                  param_store,
 | 
					                                                                  param_store,
 | 
				
			||||||
                                                                  session.get_local_collation_connection()))) {
 | 
					                                                                  session.get_local_collation_connection()))) {
 | 
				
			||||||
        LOG_WARN("parameterize syntax tree failed", K(ret));
 | 
					        LOG_WARN("parameterize syntax tree failed", K(ret));
 | 
				
			||||||
        if (OB_INVALID_ARGUMENT == ret) {
 | 
					        if (OB_INVALID_ARGUMENT == ret || OB_NOT_SUPPORTED == ret) {
 | 
				
			||||||
          pc_ctx.ps_need_parameterized_ = false;
 | 
					          pc_ctx.ps_need_parameterized_ = false;
 | 
				
			||||||
          ret = OB_SUCCESS;
 | 
					          ret = OB_SUCCESS;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
				
			|||||||
@ -21,6 +21,7 @@ namespace sql
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
int ObUDRUtils::match_udr_item(const ObString &pattern,
 | 
					int ObUDRUtils::match_udr_item(const ObString &pattern,
 | 
				
			||||||
                               const ObSQLSessionInfo &session_info,
 | 
					                               const ObSQLSessionInfo &session_info,
 | 
				
			||||||
 | 
					                               ObExecContext &ectx,
 | 
				
			||||||
                               ObIAllocator &allocator,
 | 
					                               ObIAllocator &allocator,
 | 
				
			||||||
                               ObUDRItemMgr::UDRItemRefGuard &guard,
 | 
					                               ObUDRItemMgr::UDRItemRefGuard &guard,
 | 
				
			||||||
                               PatternConstConsList *cst_cons_list)
 | 
					                               PatternConstConsList *cst_cons_list)
 | 
				
			||||||
@ -50,6 +51,9 @@ int ObUDRUtils::match_udr_item(const ObString &pattern,
 | 
				
			|||||||
      LOG_TRACE("succ to match rewrite rule item", KPC(guard.get_ref_obj()));
 | 
					      LOG_TRACE("succ to match rewrite rule item", KPC(guard.get_ref_obj()));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					  if (OB_FAIL(ret) && !ObSQLUtils::check_need_disconnect_parser_err(ret)) {
 | 
				
			||||||
 | 
					    ectx.set_need_disconnect(false);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
  return ret;
 | 
					  return ret;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -251,7 +255,7 @@ int ObUDRUtils::match_udr_and_refill_ctx(const ObString &pattern,
 | 
				
			|||||||
  if (enable_udr && !(pc_ctx.is_inner_sql() || PC_PL_MODE == pc_ctx.mode_)) {
 | 
					  if (enable_udr && !(pc_ctx.is_inner_sql() || PC_PL_MODE == pc_ctx.mode_)) {
 | 
				
			||||||
    ObIAllocator &allocator = result.get_mem_pool();
 | 
					    ObIAllocator &allocator = result.get_mem_pool();
 | 
				
			||||||
    PatternConstConsList cst_cons_list;
 | 
					    PatternConstConsList cst_cons_list;
 | 
				
			||||||
    if (OB_FAIL(match_udr_item(pattern, session, allocator, item_guard, &cst_cons_list))) {
 | 
					    if (OB_FAIL(match_udr_item(pattern, session, ectx, allocator, item_guard, &cst_cons_list))) {
 | 
				
			||||||
      LOG_WARN("failed to match user defined rewrite rule", K(ret));
 | 
					      LOG_WARN("failed to match user defined rewrite rule", K(ret));
 | 
				
			||||||
    } else if (!cst_cons_list.empty()
 | 
					    } else if (!cst_cons_list.empty()
 | 
				
			||||||
      && OB_FAIL(cons_udr_const_cons_list(cst_cons_list, pc_ctx))) {
 | 
					      && OB_FAIL(cons_udr_const_cons_list(cst_cons_list, pc_ctx))) {
 | 
				
			||||||
@ -268,10 +272,6 @@ int ObUDRUtils::match_udr_and_refill_ctx(const ObString &pattern,
 | 
				
			|||||||
      is_match_udr = true;
 | 
					      is_match_udr = true;
 | 
				
			||||||
      LOG_TRACE("succ to match user-defined rule", K(ret));
 | 
					      LOG_TRACE("succ to match user-defined rule", K(ret));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if (OB_SUCCESS != ret
 | 
					 | 
				
			||||||
      && !ObSQLUtils::check_need_disconnect_parser_err(ret)) {
 | 
					 | 
				
			||||||
      ectx.set_need_disconnect(false);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  return ret;
 | 
					  return ret;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -29,6 +29,7 @@ public:
 | 
				
			|||||||
                                      ObUDRItemMgr::UDRItemRefGuard &item_guard);
 | 
					                                      ObUDRItemMgr::UDRItemRefGuard &item_guard);
 | 
				
			||||||
  static int match_udr_item(const ObString &pattern,
 | 
					  static int match_udr_item(const ObString &pattern,
 | 
				
			||||||
                            const ObSQLSessionInfo &session_info,
 | 
					                            const ObSQLSessionInfo &session_info,
 | 
				
			||||||
 | 
					                            ObExecContext &ectx,
 | 
				
			||||||
                            ObIAllocator &allocator,
 | 
					                            ObIAllocator &allocator,
 | 
				
			||||||
                            ObUDRItemMgr::UDRItemRefGuard &guard,
 | 
					                            ObUDRItemMgr::UDRItemRefGuard &guard,
 | 
				
			||||||
                            PatternConstConsList *cst_cons_list = nullptr);
 | 
					                            PatternConstConsList *cst_cons_list = nullptr);
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user