bugfix: In the truncate function, flushed_page_id_ is not set to INVALID correctly in some cases;
This commit is contained in:
parent
5280840419
commit
9c517debaf
@ -1845,6 +1845,7 @@ int ObSharedNothingTmpFile::truncate_the_first_wbp_page_()
|
||||
int ret = OB_SUCCESS;
|
||||
bool is_flushed_page = false;
|
||||
bool is_write_back_page = false;
|
||||
bool is_dirty_page = false;
|
||||
uint32_t next_page_id = ObTmpFileGlobal::INVALID_PAGE_ID;
|
||||
|
||||
if (ObTmpFileGlobal::INVALID_PAGE_ID == begin_page_id_ ||
|
||||
@ -1857,6 +1858,12 @@ int ObSharedNothingTmpFile::truncate_the_first_wbp_page_()
|
||||
is_flushed_page = true;
|
||||
} else if (wbp_->is_write_back(fd_, begin_page_id_, ObTmpFilePageUniqKey(begin_page_virtual_id_))) {
|
||||
is_write_back_page = true;
|
||||
} else if (wbp_->is_dirty(fd_, begin_page_id_, ObTmpFilePageUniqKey(begin_page_virtual_id_))) {
|
||||
is_dirty_page = true;
|
||||
} else {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_ERROR("begin page state is unexpected", KR(ret), KPC(this));
|
||||
wbp_->print_page_entry(begin_page_id_);
|
||||
}
|
||||
|
||||
if (FAILEDx(wbp_->free_page(fd_, begin_page_id_, ObTmpFilePageUniqKey(begin_page_virtual_id_), next_page_id))) {
|
||||
@ -1873,10 +1880,6 @@ int ObSharedNothingTmpFile::truncate_the_first_wbp_page_()
|
||||
// thus, only if the page is flushed, we can check the equality of flushed_page_id_ and begin_page_id_
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_ERROR("flushed_page_id_ or flushed_data_page_num_ is unexpected", KR(ret), KPC(this));
|
||||
} else if (flushed_page_id_ == begin_page_id_) {
|
||||
flushed_page_id_ = ObTmpFileGlobal::INVALID_PAGE_ID;
|
||||
flushed_page_virtual_id_ = ObTmpFileGlobal::INVALID_VIRTUAL_PAGE_ID;
|
||||
LOG_INFO("all flushed page has been truncated", KPC(this));
|
||||
}
|
||||
}
|
||||
if (OB_SUCC(ret)) {
|
||||
@ -1884,6 +1887,19 @@ int ObSharedNothingTmpFile::truncate_the_first_wbp_page_()
|
||||
}
|
||||
} else if (is_write_back_page) {
|
||||
write_back_data_page_num_--;
|
||||
} else if (is_dirty_page) {
|
||||
if (flushed_page_id_ == begin_page_id_ && flushed_data_page_num_ != 0) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_ERROR("flushed_page_id_ or flushed_data_page_num_ is unexpected", KR(ret), KPC(this));
|
||||
}
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
if (flushed_page_id_ == begin_page_id_) {
|
||||
flushed_page_id_ = ObTmpFileGlobal::INVALID_PAGE_ID;
|
||||
flushed_page_virtual_id_ = ObTmpFileGlobal::INVALID_VIRTUAL_PAGE_ID;
|
||||
LOG_INFO("all flushed page has been truncated", KPC(this));
|
||||
}
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
|
@ -1061,6 +1061,18 @@ bool ObTmpWriteBufferPool::has_free_page_(PageEntryType type)
|
||||
return b_ret;
|
||||
}
|
||||
|
||||
void ObTmpWriteBufferPool::print_page_entry(const uint32_t page_id)
|
||||
{
|
||||
common::TCRWLock::RLockGuard guard(lock_);
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_UNLIKELY(!is_valid_page_id_(page_id))) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_ERROR("wbp use unexpected page id", KR(ret), K(page_id), K(fat_.size()));
|
||||
} else {
|
||||
LOG_INFO("page entry info", K(page_id), K(fat_[page_id]));
|
||||
}
|
||||
}
|
||||
|
||||
void ObTmpWriteBufferPool::print_statistics()
|
||||
{
|
||||
int64_t dirty_page_percentage = get_dirty_page_percentage();
|
||||
|
@ -251,6 +251,7 @@ public:
|
||||
int64_t get_max_data_page_num();
|
||||
int64_t get_meta_page_num();
|
||||
int64_t get_free_data_page_num();
|
||||
void print_page_entry(const uint32_t page_id);
|
||||
void print_statistics();
|
||||
private:
|
||||
static double MAX_DATA_PAGE_USAGE_RATIO; // control data pages ratio, can be preempted by meta pages
|
||||
|
Loading…
x
Reference in New Issue
Block a user