Fix skip index filter apply to wrong block

This commit is contained in:
obdev
2024-02-09 09:24:25 +00:00
committed by ob-robot
parent 952395e38e
commit 38b9209836
2 changed files with 9 additions and 8 deletions

View File

@ -73,7 +73,7 @@ int ObSSTableIndexFilter::check_range(
LOG_WARN("Fail to do filter by skipping index", K(ret), K(index_info));
} else {
can_use_skipping_index_filter =
(can_use_skipping_index_filter || node.is_skipping_index_used_);
(can_use_skipping_index_filter || node.filter_->is_filter_constant());
}
}
if (OB_SUCC(ret) && can_use_skipping_index_filter) {
@ -85,7 +85,8 @@ int ObSSTableIndexFilter::check_range(
for (int64_t i = 0; OB_SUCC(ret) && i < skipping_filter_nodes_.count(); ++i) {
ObSkippingFilterNode &node = skipping_filter_nodes_[i];
if (node.filter_->is_filter_constant()) {
if (node.is_skipping_index_used_ && OB_FAIL(index_info.add_skipping_filter_result(node.filter_))) {
if (!node.is_already_determinate_ &&
OB_FAIL(index_info.add_skipping_filter_result(node.filter_))) {
LOG_WARN("Fail to add skipping filter result", K(ret), K(index_info));
}
node.filter_->set_filter_uncertain();
@ -104,12 +105,13 @@ int ObSSTableIndexFilter::is_filtered_by_skipping_index(
common::ObIAllocator &allocator)
{
int ret = OB_SUCCESS;
node.is_skipping_index_used_ = false;
node.is_already_determinate_ = false;
if (OB_UNLIKELY(nullptr == node.filter_ || 1 != node.filter_->get_col_offsets().count())) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("Unexpected filter in skipping filter node", K(ret), KPC_(node.filter));
} else if (index_info.apply_skipping_filter_result(node.filter_)) {
// There is no need to check skipping index because filter result is contant already.
node.is_already_determinate_ = true;
} else {
auto *white_filter = static_cast<sql::ObWhiteFilterExecutor *>(node.filter_);
const uint32_t col_offset = white_filter->get_col_offsets(is_cg_).at(0);
@ -122,8 +124,6 @@ int ObSSTableIndexFilter::is_filtered_by_skipping_index(
*white_filter,
allocator))) {
LOG_WARN("Fail to falsifiable pushdown filter", K(ret), K(white_filter));
} else {
node.is_skipping_index_used_ = white_filter->is_filter_constant();
}
}
return ret;

View File

@ -29,7 +29,8 @@ namespace storage
struct ObSkippingFilterNode
{
ObSkippingFilterNode()
: skip_index_type_(blocksstable::ObSkipIndexType::MAX_TYPE),
: is_already_determinate_(false),
skip_index_type_(blocksstable::ObSkipIndexType::MAX_TYPE),
filter_(nullptr) {}
OB_INLINE bool is_useful() const
@ -40,9 +41,9 @@ struct ObSkippingFilterNode
{
skip_index_type_ = blocksstable::ObSkipIndexType::MAX_TYPE;
}
TO_STRING_KV(K_(is_skipping_index_used), K_(skip_index_type), KP_(filter));
TO_STRING_KV(K_(is_already_determinate), K_(skip_index_type), KP_(filter));
bool is_skipping_index_used_;
bool is_already_determinate_;
blocksstable::ObSkipIndexType skip_index_type_;
sql::ObPushdownFilterExecutor *filter_;
};