print sampled block count under ENABLE_DEBUG_LOG compile mode

This commit is contained in:
saltonz
2024-02-07 07:10:54 +00:00
committed by ob-robot
parent 010ecf801e
commit 2dcad2928e
2 changed files with 10 additions and 0 deletions

View File

@ -616,6 +616,7 @@ ObBlockSampleIterator::ObBlockSampleIterator(const SampleInfo &sample_info)
read_info_(nullptr), read_info_(nullptr),
scan_merge_(nullptr), scan_merge_(nullptr),
block_num_(0), block_num_(0),
sample_block_cnt_(0),
range_allocator_(), range_allocator_(),
range_iterator_(), range_iterator_(),
micro_range_(), micro_range_(),
@ -630,6 +631,7 @@ ObBlockSampleIterator::~ObBlockSampleIterator()
void ObBlockSampleIterator::reuse() void ObBlockSampleIterator::reuse()
{ {
block_num_ = 0; block_num_ = 0;
sample_block_cnt_ = 0;
range_allocator_.reuse(); range_allocator_.reuse();
range_iterator_.reset(); range_iterator_.reset();
micro_range_.reset(); micro_range_.reset();
@ -642,6 +644,7 @@ void ObBlockSampleIterator::reset()
read_info_ = nullptr; read_info_ = nullptr;
scan_merge_ = nullptr; scan_merge_ = nullptr;
block_num_ = 0; block_num_ = 0;
sample_block_cnt_ = 0;
range_allocator_.reset(); range_allocator_.reset();
range_iterator_.reset(); range_iterator_.reset();
micro_range_.reset(); micro_range_.reset();
@ -697,6 +700,7 @@ int ObBlockSampleIterator::get_next_row(blocksstable::ObDatumRow *&row)
STORAGE_LOG(WARN, "range is null", K(ret), K(block_num_)); STORAGE_LOG(WARN, "range is null", K(ret), K(block_num_));
} else if (return_this_sample(block_num_++)) { } else if (return_this_sample(block_num_++)) {
STORAGE_LOG(DEBUG, "open a range", K(*range), K_(block_num)); STORAGE_LOG(DEBUG, "open a range", K(*range), K_(block_num));
++sample_block_cnt_;
micro_range_.reset(); micro_range_.reset();
micro_range_ = *range; micro_range_ = *range;
if (OB_FAIL(open_range(micro_range_))) { if (OB_FAIL(open_range(micro_range_))) {
@ -708,6 +712,11 @@ int ObBlockSampleIterator::get_next_row(blocksstable::ObDatumRow *&row)
if (OB_FAIL(ret) && OB_ITER_END != ret) { if (OB_FAIL(ret) && OB_ITER_END != ret) {
STORAGE_LOG(WARN, "failed to get next row from ObBlockSampleIterator", K(ret), K(block_num_)); STORAGE_LOG(WARN, "failed to get next row from ObBlockSampleIterator", K(ret), K(block_num_));
} }
#ifdef ENABLE_DEBUG_LOG
if (OB_ITER_END == ret) {
STORAGE_LOG(INFO, "block sample scan finish", K(ret), K_(sample_block_cnt), K_(block_num), KPC_(sample_info));
}
#endif
} }
return ret; return ret;

View File

@ -166,6 +166,7 @@ private:
const ObITableReadInfo *read_info_; const ObITableReadInfo *read_info_;
ObMultipleScanMerge *scan_merge_; ObMultipleScanMerge *scan_merge_;
int64_t block_num_; int64_t block_num_;
int64_t sample_block_cnt_;
common::ObArenaAllocator range_allocator_; common::ObArenaAllocator range_allocator_;
ObBlockSampleRangeIterator range_iterator_; ObBlockSampleRangeIterator range_iterator_;
blocksstable::ObDatumRange micro_range_; blocksstable::ObDatumRange micro_range_;