[CP] fix bug about update memtables in table store
This commit is contained in:
@ -584,7 +584,9 @@ int ObMemtableArray::build(
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ObMemtableArray::rebuild(common::ObIArray<ObTableHandleV2> &handle_array)
|
int ObMemtableArray::rebuild(
|
||||||
|
const share::SCN &clog_checkpoint_scn,
|
||||||
|
common::ObIArray<ObTableHandleV2> &handle_array)
|
||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
|
|
||||||
@ -593,7 +595,9 @@ int ObMemtableArray::rebuild(common::ObIArray<ObTableHandleV2> &handle_array)
|
|||||||
LOG_ERROR("ObMemtableArray not inited", K(ret), KPC(this), K(handle_array));
|
LOG_ERROR("ObMemtableArray not inited", K(ret), KPC(this), K(handle_array));
|
||||||
} else {
|
} else {
|
||||||
ObITable *last_memtable = get_table(count() - 1);
|
ObITable *last_memtable = get_table(count() - 1);
|
||||||
SCN end_scn = (NULL == last_memtable) ? SCN::min_scn() : last_memtable->get_end_scn();
|
SCN last_memtable_end_scn = (NULL == last_memtable)
|
||||||
|
? clog_checkpoint_scn // memtable was filtered when tablet was initialized, use ckpt scn to filter again
|
||||||
|
: last_memtable->get_end_scn();
|
||||||
|
|
||||||
for (int64_t i = 0; OB_SUCC(ret) && i < handle_array.count(); ++i) {
|
for (int64_t i = 0; OB_SUCC(ret) && i < handle_array.count(); ++i) {
|
||||||
memtable::ObMemtable *memtable = nullptr;
|
memtable::ObMemtable *memtable = nullptr;
|
||||||
@ -604,8 +608,11 @@ int ObMemtableArray::rebuild(common::ObIArray<ObTableHandleV2> &handle_array)
|
|||||||
} else if (FALSE_IT(memtable = reinterpret_cast<memtable::ObMemtable *>(table))) {
|
} else if (FALSE_IT(memtable = reinterpret_cast<memtable::ObMemtable *>(table))) {
|
||||||
} else if (memtable->is_empty()) {
|
} else if (memtable->is_empty()) {
|
||||||
FLOG_INFO("Empty memtable discarded", KPC(memtable));
|
FLOG_INFO("Empty memtable discarded", KPC(memtable));
|
||||||
} else if (table->get_end_scn() < end_scn) {
|
} else if (memtable->get_end_scn() == last_memtable_end_scn && memtable == last_memtable) {
|
||||||
} else if (table->get_end_scn() == end_scn && table == last_memtable) { //fix issue 41996395
|
// fix issue 41996395
|
||||||
|
// if last memtable is freezing, its end scn may still be INT64_MAX, which will cause the new active memtable to be filtered.
|
||||||
|
continue;
|
||||||
|
} else if (memtable->get_end_scn() <= last_memtable_end_scn) {
|
||||||
} else if (OB_FAIL(add_table(table))) {
|
} else if (OB_FAIL(add_table(table))) {
|
||||||
LOG_WARN("failed to add memtable to curr memtables", K(ret), KPC(this));
|
LOG_WARN("failed to add memtable to curr memtables", K(ret), KPC(this));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -111,7 +111,7 @@ public:
|
|||||||
int init(common::ObIAllocator *allocator);
|
int init(common::ObIAllocator *allocator);
|
||||||
int init(common::ObIAllocator *allocator, const ObMemtableArray &other);
|
int init(common::ObIAllocator *allocator, const ObMemtableArray &other);
|
||||||
int build(common::ObIArray<ObTableHandleV2> &handle_array, const int64_t start_pos = 0);
|
int build(common::ObIArray<ObTableHandleV2> &handle_array, const int64_t start_pos = 0);
|
||||||
int rebuild(common::ObIArray<ObTableHandleV2> &handle_array);
|
int rebuild(const share::SCN &clog_checkpoint_scn, common::ObIArray<ObTableHandleV2> &handle_array);
|
||||||
int prepare_allocate();
|
int prepare_allocate();
|
||||||
int find(const ObITable::TableKey &table_key, ObTableHandleV2 &handle) const;
|
int find(const ObITable::TableKey &table_key, ObTableHandleV2 &handle) const;
|
||||||
int find(const share::SCN &start_scn, const int64_t base_version, ObITable *&table, int64_t &mem_pos) const;
|
int find(const share::SCN &start_scn, const int64_t base_version, ObITable *&table, int64_t &mem_pos) const;
|
||||||
|
|||||||
@ -440,7 +440,7 @@ int ObTabletTableStore::update_memtables()
|
|||||||
} else if (OB_FAIL(tablet_ptr_->get_memtable_mgr()->get_all_memtables(inc_memtables))) {
|
} else if (OB_FAIL(tablet_ptr_->get_memtable_mgr()->get_all_memtables(inc_memtables))) {
|
||||||
LOG_WARN("failed to get all memtables from memtable_mgr", K(ret));
|
LOG_WARN("failed to get all memtables from memtable_mgr", K(ret));
|
||||||
} else if (FALSE_IT(time_guard.click("get_all_memtable"))) {
|
} else if (FALSE_IT(time_guard.click("get_all_memtable"))) {
|
||||||
} else if (OB_FAIL(memtables_.rebuild(inc_memtables))) {
|
} else if (OB_FAIL(memtables_.rebuild(tablet_ptr_->get_clog_checkpoint_scn(), inc_memtables))) {
|
||||||
LOG_ERROR("failed to rebuild table store memtables", K(ret), K(inc_memtables), KPC(this));
|
LOG_ERROR("failed to rebuild table store memtables", K(ret), K(inc_memtables), KPC(this));
|
||||||
} else if (FALSE_IT(time_guard.click("memtables_.rebuild"))) {
|
} else if (FALSE_IT(time_guard.click("memtables_.rebuild"))) {
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user