提交 27c813df 编写于 作者: Y yht0 提交者: wangzelin.wzl

Fix skip range bug

上级 1800b15f
......@@ -12,6 +12,7 @@
#include "ob_multiple_scan_merge_impl.h"
#include "share/ob_get_compat_mode.h"
#include "storage/ob_sstable.h"
using namespace oceanbase::storage;
using namespace oceanbase::common;
......@@ -257,10 +258,20 @@ int ObMultipleScanMergeImpl::prepare_range_skip()
{
int ret = OB_SUCCESS;
memtable::ObIMemtableCtx* mem_ctx = access_ctx_->store_ctx_->mem_ctx_;
bool contain_uncommitted_row = false;
ObITable *table = NULL;
ObITable* last_table = NULL;
const ObIArray<ObITable*>& tables = tables_handle_.get_tables();
if (tables.count() > 0) {
if (OB_FAIL(tables.at(tables.count() - 1, last_table))) {
// If sstable contains uncommitted rows, disable range skip
for (int64_t i = tables.count() - 1; OB_SUCC(ret) && !contain_uncommitted_row && i >= 0; --i) {
if (OB_FAIL(tables.at(i, table))) {
STORAGE_LOG(WARN, "Fail to get i store, ", K(i), K(ret));
} else if (table->is_sstable()) {
contain_uncommitted_row = static_cast<ObSSTable *>(table)->contain_uncommitted_row();
}
}
if (OB_SUCC(ret) && OB_FAIL(tables.at(tables.count() - 1, last_table))) {
last_table = NULL;
}
} else {
......@@ -270,9 +281,11 @@ int ObMultipleScanMergeImpl::prepare_range_skip()
if (NULL != last_table) {
const bool skip_switch = true;
bool enable_skip = skip_switch && (access_param_->iter_param_.table_id_ & 0xffffff) > 50000 &&
bool enable_skip = !contain_uncommitted_row && skip_switch &&
(access_param_->iter_param_.table_id_ & 0xffffff) > 50000 &&
!access_ctx_->query_flag_.is_whole_macro_scan();
bool enable_purge = skip_switch && NULL != mem_ctx && mem_ctx->get_read_snapshot() < INT64_MAX - 1024 &&
bool enable_purge = !contain_uncommitted_row && skip_switch && NULL != mem_ctx &&
mem_ctx->get_read_snapshot() < INT64_MAX - 1024 &&
mem_ctx->get_read_snapshot() > last_table->get_base_version();
if (enable_skip) {
range_skip_.init(&iters_);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册