[FIX] check is direct_load_memtable or data_memtable before static cast
This commit is contained in:
parent
1fba63fb19
commit
ba524159bf
@ -1321,10 +1321,11 @@ int ObMultipleMerge::prepare_tables_from_iterator(ObTableStoreIterator &table_it
|
||||
LOG_DEBUG("cur table is empty", K(ret), KPC(table_ptr));
|
||||
continue;
|
||||
} else if (table_ptr->is_memtable()) {
|
||||
read_released_memtable = read_released_memtable ||
|
||||
TabletMemtableFreezeState::RELEASED == (static_cast<memtable::ObMemtable*>(table_ptr))->get_freeze_state();
|
||||
++memtable_cnt;
|
||||
if (table_ptr->is_direct_load_memtable()) {
|
||||
if (table_ptr->is_data_memtable()) {
|
||||
read_released_memtable = read_released_memtable ||
|
||||
TabletMemtableFreezeState::RELEASED == (static_cast<memtable::ObMemtable*>(table_ptr))->get_freeze_state();
|
||||
} else if (table_ptr->is_direct_load_memtable()) {
|
||||
ObDDLMemtable *ddl_memtable = nullptr;
|
||||
if (OB_FAIL((static_cast<ObDDLKV*>(table_ptr)->get_first_ddl_memtable(ddl_memtable)))) {
|
||||
if (ret == OB_ENTRY_NOT_EXIST) {
|
||||
|
@ -64,7 +64,7 @@ int ObGetSampleIterHelper::can_retire_to_memtable_row_sample_(bool &retire, ObIA
|
||||
if (get_table_param_.is_valid()) {
|
||||
int64_t memtable_row_count = 0;
|
||||
int64_t sstable_row_count = 0;
|
||||
common::ObSEArray<ObITable *, 4> memtables;
|
||||
common::ObSEArray<memtable::ObMemtable *, 4> memtables;
|
||||
|
||||
// iter all tables to estimate row count
|
||||
get_table_param_.tablet_iter_.table_iter()->resume();
|
||||
@ -78,12 +78,15 @@ int ObGetSampleIterHelper::can_retire_to_memtable_row_sample_(bool &retire, ObIA
|
||||
} else {
|
||||
STORAGE_LOG(WARN, "Fail to get next table iter", K(ret), K(get_table_param_.tablet_iter_.table_iter()));
|
||||
}
|
||||
} else if (table->is_memtable()) {
|
||||
if (OB_FAIL(memtables.push_back(table))) {
|
||||
} else if (table->is_data_memtable()) {
|
||||
memtable::ObMemtable *memtable = static_cast<memtable::ObMemtable *>(table);
|
||||
if (OB_FAIL(memtables.push_back(memtable))) {
|
||||
STORAGE_LOG(WARN, "push back memtable failed", KR(ret));
|
||||
} else {
|
||||
memtable_row_count += static_cast<memtable::ObMemtable *>(table)->get_physical_row_cnt();
|
||||
memtable_row_count += memtable->get_physical_row_cnt();
|
||||
}
|
||||
} else if (table->is_direct_load_memtable()) {
|
||||
// FIXEM : @suzhi.yt support direct load memtable get_row_count();
|
||||
} else if (table->is_sstable()) {
|
||||
sstable_row_count += static_cast<ObSSTable *>(table)->get_row_count();
|
||||
}
|
||||
@ -112,7 +115,7 @@ int ObGetSampleIterHelper::can_retire_to_memtable_row_sample_(bool &retire, ObIA
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObGetSampleIterHelper::get_memtable_sample_ranges_(const ObIArray<ObITable *> &memtables,
|
||||
int ObGetSampleIterHelper::get_memtable_sample_ranges_(const ObIArray<memtable::ObMemtable *> &memtables,
|
||||
ObIArray<ObDatumRange> &sample_ranges)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
@ -121,7 +124,7 @@ int ObGetSampleIterHelper::get_memtable_sample_ranges_(const ObIArray<ObITable *
|
||||
|
||||
// get split ranges from all memtables
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < memtables.count(); i++) {
|
||||
memtable::ObMemtable *memtable = static_cast<memtable::ObMemtable *>(memtables.at(i));
|
||||
memtable::ObMemtable *memtable = memtables.at(i);
|
||||
int tmp_ret = OB_SUCCESS;
|
||||
if (OB_ISNULL(memtable)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
|
@ -48,7 +48,7 @@ private:
|
||||
// if need retire to row sample, sample_memtable_ranges must not be null
|
||||
int can_retire_to_memtable_row_sample_(bool &retire, ObIArray<blocksstable::ObDatumRange> &sample_ranges);
|
||||
|
||||
int get_memtable_sample_ranges_(const ObIArray<ObITable *> &memtables,
|
||||
int get_memtable_sample_ranges_(const ObIArray<memtable::ObMemtable *> &memtables,
|
||||
ObIArray<blocksstable::ObDatumRange> &sample_ranges);
|
||||
|
||||
private:
|
||||
|
@ -153,6 +153,10 @@ int ObTableEstimator::estimate_multi_scan_row_count(
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (current_table->is_direct_load_memtable()) {
|
||||
// FIXME : @suzhi.yt
|
||||
ret = OB_NOT_SUPPORTED;
|
||||
LOG_WARN("not supported memtable", KR(ret), KPC(current_table));
|
||||
} else {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("unexpected table type", K(ret), K(*current_table));
|
||||
|
@ -929,9 +929,12 @@ void ObDataCheckpoint::add_diagnose_info_for_ls_frozen_()
|
||||
RLOCK(LS_FROZEN);
|
||||
ls_frozen_list_.get_iterator(iterator);
|
||||
while (iterator.has_next()) {
|
||||
memtable::ObMemtable *memtable = static_cast<memtable::ObMemtable*>(iterator.get_next());
|
||||
if (!memtable->is_active_checkpoint()) {
|
||||
memtable->report_memtable_diagnose_info(memtable::ObMemtable::AddCheckpointDiagnoseInfoForMemtable());
|
||||
ObITabletMemtable *tablet_memtable = static_cast<ObITabletMemtable *>(iterator.get_next());
|
||||
if (tablet_memtable->is_data_memtable()) {
|
||||
if (!tablet_memtable->is_active_checkpoint()) {
|
||||
(static_cast<memtable::ObMemtable *>(tablet_memtable))
|
||||
->report_memtable_diagnose_info(memtable::ObMemtable::AddCheckpointDiagnoseInfoForMemtable());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -581,10 +581,14 @@ int ObTabletBackfillTXTask::get_backfill_tx_memtables_(
|
||||
} else {
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < memtables.count(); ++i) {
|
||||
ObITable *table = memtables.at(i).get_table();
|
||||
memtable::ObMemtable *memtable = static_cast<memtable::ObMemtable *>(table);
|
||||
if (OB_ISNULL(table) || !table->is_data_memtable()) {
|
||||
memtable::ObMemtable *memtable = nullptr;
|
||||
if (OB_ISNULL(table) || !table->is_tablet_memtable()) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("table should not be NULL or table type is unexpected", K(ret), KP(table));
|
||||
} else if (table->is_direct_load_memtable()) {
|
||||
ret = OB_NOT_SUPPORTED;
|
||||
LOG_WARN("find a direct load memtable", KR(ret), K(tablet_info_.tablet_id_), KPC(table));
|
||||
} else if (FALSE_IT(memtable = static_cast<memtable::ObMemtable *>(table))) {
|
||||
} else if (table->get_start_scn() >= backfill_tx_ctx_->log_sync_scn_
|
||||
&& memtable->not_empty()
|
||||
&& !memtable->get_rec_scn().is_max()) {
|
||||
|
@ -1300,10 +1300,14 @@ int ObTransferReplaceTableTask::check_src_memtable_is_empty_(
|
||||
} else if (!memtables.empty()) {
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < memtables.count(); ++i) {
|
||||
ObITable *table = memtables.at(i).get_table();
|
||||
memtable::ObMemtable *memtable = static_cast<memtable::ObMemtable *>(table);
|
||||
if (OB_ISNULL(table) || !table->is_memtable()) {
|
||||
memtable::ObMemtable *memtable = nullptr;
|
||||
if (OB_ISNULL(table) || !table->is_tablet_memtable()) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("table should not be NULL or table type is unexpected", K(ret), KP(table));
|
||||
} else if (table->is_direct_load_memtable()) {
|
||||
ret = OB_TRANSFER_SYS_ERROR;
|
||||
LOG_ERROR("find a direct load memtable", K(ret), KPC(table));
|
||||
} else if (FALSE_IT(memtable = static_cast<memtable::ObMemtable *>(table))) {
|
||||
} else if (memtable->is_active_memtable()) {
|
||||
if (memtable->not_empty()) {
|
||||
ret = OB_TRANSFER_SYS_ERROR;
|
||||
|
@ -5763,9 +5763,12 @@ void ObLSTabletService::dump_diag_info_for_old_row_loss(
|
||||
} else if (table->is_sstable()) {
|
||||
FLOG_INFO("Found rowkey in the sstable",
|
||||
KPC(row), KPC(reinterpret_cast<ObSSTable*>(table)));
|
||||
} else {
|
||||
} else if (table->is_data_memtable()) {
|
||||
FLOG_INFO("Found rowkey in the memtable",
|
||||
KPC(row), KPC(reinterpret_cast<memtable::ObMemtable*>(table)));
|
||||
KPC(row), KPC(static_cast<memtable::ObMemtable*>(table)));
|
||||
} else if (table->is_direct_load_memtable()) {
|
||||
FLOG_INFO("Found rowkey in the direct load memtable",
|
||||
KPC(row), KPC(static_cast<ObITabletMemtable*>(table)));
|
||||
}
|
||||
|
||||
// ignore error in the loop
|
||||
@ -6059,7 +6062,9 @@ int ObLSTabletService::estimate_block_count_and_row_count(
|
||||
} else if (OB_ISNULL(table)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("get unexpected null table", K(ret), K(tablet_iter.table_iter()));
|
||||
} else if (table->is_memtable()) {
|
||||
} else if (table->is_direct_load_memtable()) {
|
||||
// FIXME : @suzhi.yt
|
||||
} else if (table->is_data_memtable()) {
|
||||
memtable_row_count += static_cast<memtable::ObMemtable *>(table)->get_physical_row_cnt();
|
||||
} else if (table->is_sstable()) {
|
||||
sstable = static_cast<ObSSTable *>(table);
|
||||
|
@ -931,7 +931,11 @@ int ObPartitionRangeSpliter::get_single_range_info(const ObStoreRange &store_ran
|
||||
if (OB_ISNULL(table)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
STORAGE_LOG(WARN, "Invalid table pointer", K(ret), KP(table));
|
||||
} else if (!table->is_sstable()) {
|
||||
} else if (table->is_direct_load_memtable()) {
|
||||
// FIXME : @suzhi.yt
|
||||
ret = OB_NOT_SUPPORTED;
|
||||
STORAGE_LOG(WARN, "get single range from direct load memtable not supported", KR(ret), KPC(table));
|
||||
} else if (table->is_data_memtable()) {
|
||||
memtable::ObMemtable *memtable = static_cast<memtable::ObMemtable *>(table);
|
||||
int64_t row_count = 0;
|
||||
if (OB_FAIL(memtable->estimate_phy_size(&store_range.get_start_key(),
|
||||
@ -940,7 +944,7 @@ int ObPartitionRangeSpliter::get_single_range_info(const ObStoreRange &store_ran
|
||||
row_count))) {
|
||||
STORAGE_LOG(WARN, "Failed to get single range info from memtable", K(ret), K(store_range));
|
||||
}
|
||||
} else {
|
||||
} else if (table->is_sstable()) {
|
||||
ObSSTable *sstable = static_cast<ObSSTable *>(table);
|
||||
if (store_range.is_whole_range()) {
|
||||
ObSSTableMetaHandle meta_handle;
|
||||
@ -1073,26 +1077,30 @@ int ObPartitionRangeSpliter::split_ranges(ObRangeSplitInfo &range_info,
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObPartitionRangeSpliter::split_ranges_memtable(ObRangeSplitInfo &range_info,
|
||||
ObIAllocator &allocator,
|
||||
ObIArray<ObStoreRange> &range_array)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
|
||||
ObITable *table = range_info.tables_->at(0);
|
||||
if (OB_UNLIKELY(!range_info.is_valid() || range_info.is_sstable())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
STORAGE_LOG(WARN, "Invalid range info to split ranges for memtable", K(ret));
|
||||
} else if (OB_UNLIKELY(range_info.tables_->count() != 1)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
STORAGE_LOG(WARN, "Unexpected table count for memtable range info", K(ret), K(range_info));
|
||||
} else {
|
||||
} else if (OB_ISNULL(table)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
STORAGE_LOG(WARN, "Unexpected null table", K(ret), KP(table), K(range_info));
|
||||
} else if (table->is_direct_load_memtable()) {
|
||||
// FIXME : @suzhi.yt support direct load memtable?
|
||||
ret = OB_NOT_SUPPORTED;
|
||||
STORAGE_LOG(WARN, "not supported memtable", KR(ret), KPC(table));
|
||||
} else if (table->is_data_memtable()) {
|
||||
ObSEArray<ObStoreRange, 16> store_ranges;
|
||||
memtable::ObMemtable *memtable = static_cast<memtable::ObMemtable *>(range_info.tables_->at(0));
|
||||
if (OB_ISNULL(memtable)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
STORAGE_LOG(WARN, "Unexpected null memtable", K(ret), KP(memtable), K(range_info));
|
||||
} else if (OB_FAIL(memtable->get_split_ranges(
|
||||
memtable::ObMemtable *memtable = static_cast<memtable::ObMemtable *>(table);
|
||||
|
||||
if (OB_FAIL(memtable->get_split_ranges(
|
||||
&range_info.store_range_->get_start_key(),
|
||||
&range_info.store_range_->get_end_key(),
|
||||
range_info.parallel_target_count_,
|
||||
|
@ -4219,11 +4219,17 @@ int ObTablet::get_newest_schema_version(int64_t &schema_version) const
|
||||
int64_t max_schema_version_on_memtable = 0;
|
||||
int64_t unused_max_column_cnt_on_memtable = 0;
|
||||
for (int64_t idx = 0; OB_SUCC(ret) && idx < memtables.count(); ++idx) {
|
||||
memtable::ObMemtable *memtable = static_cast<memtable::ObMemtable *>(memtables.at(idx));
|
||||
if (OB_FAIL(memtable->get_schema_info(
|
||||
store_column_cnt_in_schema,
|
||||
max_schema_version_on_memtable, unused_max_column_cnt_on_memtable))) {
|
||||
LOG_WARN("failed to get schema info from memtable", KR(ret), KPC(memtable));
|
||||
ObITable *table = memtables.at(idx);
|
||||
if (table->is_data_memtable()) {
|
||||
ObMemtable *memtable = static_cast<memtable::ObMemtable *>(table);
|
||||
if (OB_FAIL(memtable->get_schema_info(
|
||||
store_column_cnt_in_schema, max_schema_version_on_memtable, unused_max_column_cnt_on_memtable))) {
|
||||
LOG_WARN("failed to get schema info from memtable", KR(ret), KPC(table));
|
||||
}
|
||||
} else if (table->is_direct_load_memtable()) {
|
||||
// FIXME : @suzhi.yt
|
||||
// ret = OB_NOT_SUPPORTED;
|
||||
LOG_INFO("find a direct load memtable", KR(ret));
|
||||
}
|
||||
}
|
||||
if (OB_SUCC(ret)) {
|
||||
@ -5557,12 +5563,19 @@ int ObTablet::get_storage_schema_for_transfer_in(
|
||||
if (OB_ISNULL(table)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("table in tables_handle is invalid", K(ret), KP(table));
|
||||
} else if (OB_FAIL(static_cast<memtable::ObMemtable *>(table)->get_schema_info(
|
||||
store_column_cnt_in_schema,
|
||||
max_schema_version_in_memtable, max_column_cnt_in_memtable))) {
|
||||
LOG_WARN("failed to get schema info from memtable", KR(ret), KPC(table));
|
||||
} else if (table->is_data_memtable()) {
|
||||
ObMemtable *memtable = static_cast<memtable::ObMemtable *>(table);
|
||||
if (OB_FAIL(memtable->get_schema_info(
|
||||
store_column_cnt_in_schema, max_schema_version_in_memtable, max_column_cnt_in_memtable))) {
|
||||
LOG_WARN("failed to get schema info from memtable", KR(ret), KPC(table));
|
||||
}
|
||||
} else if (table->is_direct_load_memtable()) {
|
||||
// FIXME : @suzhi.yt
|
||||
// ret = OB_NOT_SUPPORTED;
|
||||
LOG_INFO("find a direct load memtable", KR(ret));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (OB_FAIL(ret)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user