fix osg bug and failed cases
This commit is contained in:
		@ -244,11 +244,13 @@ int ObOptOSGColumnStat::inner_merge_min(const ObDatum &datum, const ObObjMeta &m
 | 
				
			|||||||
      min_val_.meta_ = meta;
 | 
					      min_val_.meta_ = meta;
 | 
				
			||||||
      min_val_.cmp_func_ = cmp_func;
 | 
					      min_val_.cmp_func_ = cmp_func;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    LOG_TRACE("succeed to merge min datum", K(*min_val_.datum_), K(datum), K(meta));
 | 
				
			||||||
  } else if (min_val_.datum_->is_null()) {
 | 
					  } else if (min_val_.datum_->is_null()) {
 | 
				
			||||||
    inner_min_allocator_.reuse();
 | 
					    inner_min_allocator_.reuse();
 | 
				
			||||||
    if (OB_FAIL(min_val_.datum_->deep_copy(datum, inner_min_allocator_))) {
 | 
					    if (OB_FAIL(min_val_.datum_->deep_copy(datum, inner_min_allocator_))) {
 | 
				
			||||||
      LOG_WARN("failed to deep copy datum");
 | 
					      LOG_WARN("failed to deep copy datum");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    LOG_TRACE("succeed to merge min datum", K(*min_val_.datum_), K(datum), K(meta));
 | 
				
			||||||
  } else {
 | 
					  } else {
 | 
				
			||||||
    int cmp_ret = 0;
 | 
					    int cmp_ret = 0;
 | 
				
			||||||
    if (OB_FAIL(min_val_.cmp_func_(*min_val_.datum_, datum, cmp_ret))) {
 | 
					    if (OB_FAIL(min_val_.cmp_func_(*min_val_.datum_, datum, cmp_ret))) {
 | 
				
			||||||
 | 
				
			|||||||
@ -97,7 +97,9 @@ public:
 | 
				
			|||||||
  ObArenaAllocator inner_max_allocator_;
 | 
					  ObArenaAllocator inner_max_allocator_;
 | 
				
			||||||
  ObArenaAllocator inner_allocator_;
 | 
					  ObArenaAllocator inner_allocator_;
 | 
				
			||||||
  ObIAllocator &allocator_;
 | 
					  ObIAllocator &allocator_;
 | 
				
			||||||
  TO_STRING_KV(K_(col_stat));
 | 
					  TO_STRING_KV(K_(col_stat),
 | 
				
			||||||
 | 
					               K_(min_val),
 | 
				
			||||||
 | 
					               K_(max_val));
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
  int inner_merge_min(const ObDatum &datum, const ObObjMeta &meta, const ObDatumCmpFuncType cmp_func);
 | 
					  int inner_merge_min(const ObDatum &datum, const ObObjMeta &meta, const ObDatumCmpFuncType cmp_func);
 | 
				
			||||||
  int inner_merge_max(const ObDatum &datum, const ObObjMeta &meta, const ObDatumCmpFuncType cmp_func);
 | 
					  int inner_merge_max(const ObDatum &datum, const ObObjMeta &meta, const ObDatumCmpFuncType cmp_func);
 | 
				
			||||||
 | 
				
			|||||||
@ -543,6 +543,21 @@ public:
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
    return ret;
 | 
					    return ret;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  int persistence_col_stats()
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    int ret = OB_SUCCESS;
 | 
				
			||||||
 | 
					    for (int64_t i = 0; OB_SUCC(ret) && i < col_stat_array_.count(); ++i) {
 | 
				
			||||||
 | 
					      if (OB_ISNULL(col_stat_array_.at(i))) {
 | 
				
			||||||
 | 
					        ret = OB_ERR_UNEXPECTED;
 | 
				
			||||||
 | 
					        OB_LOG(WARN, "get unexpected null");
 | 
				
			||||||
 | 
					      } else if (OB_FAIL(col_stat_array_.at(i)->set_min_max_datum_to_obj())) {
 | 
				
			||||||
 | 
					        OB_LOG(WARN, "failed to persistence min max");
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    return ret;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  TO_STRING_KV(K_(col_stat_array), K_(table_stat_array));
 | 
					  TO_STRING_KV(K_(col_stat_array), K_(table_stat_array));
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
  common::ObSEArray<ObOptTableStat *, 64> table_stat_array_;
 | 
					  common::ObSEArray<ObOptTableStat *, 64> table_stat_array_;
 | 
				
			||||||
 | 
				
			|||||||
@ -170,8 +170,9 @@ int ObInsertLogPlan::generate_osg_share_info(OSGShareInfo *&info)
 | 
				
			|||||||
    LOG_WARN("failed to allocate memory");
 | 
					    LOG_WARN("failed to allocate memory");
 | 
				
			||||||
  } else {
 | 
					  } else {
 | 
				
			||||||
    stmt = static_cast<const ObInsertStmt *>(get_stmt());
 | 
					    stmt = static_cast<const ObInsertStmt *>(get_stmt());
 | 
				
			||||||
    uint64_t table_id = stmt->get_insert_table_info().table_id_;
 | 
					    const ObInsertTableInfo& table_info = stmt->get_insert_table_info();
 | 
				
			||||||
    uint64_t ref_table_id = stmt->get_insert_table_info().ref_table_id_;
 | 
					    uint64_t table_id = table_info.table_id_;
 | 
				
			||||||
 | 
					    uint64_t ref_table_id = table_info.ref_table_id_;
 | 
				
			||||||
    if (OB_FAIL(schema_guard->get_table_schema(table_id, ref_table_id, stmt, tab_schema))) {
 | 
					    if (OB_FAIL(schema_guard->get_table_schema(table_id, ref_table_id, stmt, tab_schema))) {
 | 
				
			||||||
      LOG_WARN("fail to get table schema", K(ref_table_id), K(tab_schema), K(ret));
 | 
					      LOG_WARN("fail to get table schema", K(ref_table_id), K(tab_schema), K(ret));
 | 
				
			||||||
    } else if (OB_ISNULL(tab_schema)) {
 | 
					    } else if (OB_ISNULL(tab_schema)) {
 | 
				
			||||||
@ -179,12 +180,11 @@ int ObInsertLogPlan::generate_osg_share_info(OSGShareInfo *&info)
 | 
				
			|||||||
      LOG_WARN("get unexpected null pointer", K(ret));
 | 
					      LOG_WARN("get unexpected null pointer", K(ret));
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
      const ObColumnSchemaV2 *col_schema = NULL;
 | 
					      const ObColumnSchemaV2 *col_schema = NULL;
 | 
				
			||||||
      const ObInsertTableInfo& table_info = stmt->get_insert_table_info();
 | 
					 | 
				
			||||||
      ObSEArray<uint64_t, 4> generated_column_ids;
 | 
					      ObSEArray<uint64_t, 4> generated_column_ids;
 | 
				
			||||||
      info->table_id_ = ref_table_id;
 | 
					      info->table_id_ = ref_table_id;
 | 
				
			||||||
      if (tab_schema->is_partitioned_table()) {
 | 
					      if (tab_schema->is_partitioned_table()) {
 | 
				
			||||||
        info->part_level_ = tab_schema->get_part_level();
 | 
					        info->part_level_ = tab_schema->get_part_level();
 | 
				
			||||||
        if (OB_FAIL(gen_calc_part_id_expr(table_id,
 | 
					        if (OB_FAIL(gen_calc_part_id_expr(table_info.loc_table_id_,
 | 
				
			||||||
                                          ref_table_id,
 | 
					                                          ref_table_id,
 | 
				
			||||||
                                          CALC_PARTITION_TABLET_ID,
 | 
					                                          CALC_PARTITION_TABLET_ID,
 | 
				
			||||||
                                          info->calc_part_id_expr_))) {
 | 
					                                          info->calc_part_id_expr_))) {
 | 
				
			||||||
 | 
				
			|||||||
@ -298,6 +298,10 @@ int ObDirectLoadTabletMergeCtx::collect_sql_statistics(
 | 
				
			|||||||
          LOG_WARN("failed to update dml stat local cache", K(ret));
 | 
					          LOG_WARN("failed to update dml stat local cache", K(ret));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					      // persistence col stat once a merge task finished
 | 
				
			||||||
 | 
					      if (OB_SUCC(ret) && OB_FAIL(sql_statistics.persistence_col_stats())) {
 | 
				
			||||||
 | 
					        LOG_WARN("failed to persistence col stats");
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  return ret;
 | 
					  return ret;
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user