decide freeze_clock in ObDataCheckpoint
This commit is contained in:
@ -13,6 +13,8 @@
|
|||||||
#include "storage/checkpoint/ob_data_checkpoint.h"
|
#include "storage/checkpoint/ob_data_checkpoint.h"
|
||||||
#include "storage/tx_storage/ob_checkpoint_service.h"
|
#include "storage/tx_storage/ob_checkpoint_service.h"
|
||||||
#include "storage/ls/ob_ls.h"
|
#include "storage/ls/ob_ls.h"
|
||||||
|
#include "storage/memtable/ob_memtable.h"
|
||||||
|
#include "storage/ls/ob_freezer.h"
|
||||||
|
|
||||||
namespace oceanbase
|
namespace oceanbase
|
||||||
{
|
{
|
||||||
@ -524,11 +526,39 @@ int ObDataCheckpoint::add_to_new_create(ObFreezeCheckpoint *ob_freeze_checkpoint
|
|||||||
{
|
{
|
||||||
ObSpinLockGuard guard(lock_);
|
ObSpinLockGuard guard(lock_);
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
|
|
||||||
if (OB_FAIL(insert_(ob_freeze_checkpoint, new_create_list_, false))) {
|
if (OB_FAIL(insert_(ob_freeze_checkpoint, new_create_list_, false))) {
|
||||||
STORAGE_LOG(ERROR, "Add To Active Failed");
|
STORAGE_LOG(ERROR, "Add To Active Failed");
|
||||||
|
} else if (OB_FAIL(decide_freeze_clock_(ob_freeze_checkpoint))) {
|
||||||
|
STORAGE_LOG(WARN, "fail to decide freeze_clock", K(ret));
|
||||||
} else {
|
} else {
|
||||||
ob_freeze_checkpoint->location_ = NEW_CREATE;
|
ob_freeze_checkpoint->location_ = NEW_CREATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ObDataCheckpoint::decide_freeze_clock_(ObFreezeCheckpoint *ob_freeze_checkpoint)
|
||||||
|
{
|
||||||
|
int ret = OB_SUCCESS;
|
||||||
|
ObFreezer *freezer = nullptr;
|
||||||
|
memtable::ObMemtable *memtable = nullptr;
|
||||||
|
|
||||||
|
if (OB_ISNULL(ls_) || OB_ISNULL(ob_freeze_checkpoint)) {
|
||||||
|
ret = OB_ERR_UNEXPECTED;
|
||||||
|
STORAGE_LOG(WARN, "ls or ob_freeze_checkpoint cannot be null", K(ret), K(ls_), K(ob_freeze_checkpoint));
|
||||||
|
} else if (FALSE_IT(freezer = ls_->get_freezer())) {
|
||||||
|
} else if (OB_ISNULL(freezer)) {
|
||||||
|
ret = OB_ERR_UNEXPECTED;
|
||||||
|
STORAGE_LOG(WARN, "freezer cannot be null", K(ret));
|
||||||
|
} else if (FALSE_IT(memtable = static_cast<memtable::ObMemtable *>(ob_freeze_checkpoint))) {
|
||||||
|
} else {
|
||||||
|
// freeze_snapshot_version requires that two memtables of a tablet
|
||||||
|
// cannot join in the same logstream_freeze task
|
||||||
|
// otherwise freeze_snapshot_version of the old memtable will be too large
|
||||||
|
(void)memtable->set_freeze_clock(freezer->get_freeze_clock());
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -149,6 +149,7 @@ private:
|
|||||||
int get_need_flush_tablets_(const share::SCN recycle_scn,
|
int get_need_flush_tablets_(const share::SCN recycle_scn,
|
||||||
common::ObIArray<ObTabletID> &flush_tablets);
|
common::ObIArray<ObTabletID> &flush_tablets);
|
||||||
int freeze_base_on_needs_(share::SCN recycle_scn);
|
int freeze_base_on_needs_(share::SCN recycle_scn);
|
||||||
|
int decide_freeze_clock_(ObFreezeCheckpoint *ob_freeze_checkpoint);
|
||||||
|
|
||||||
static const int64_t LOOP_TRAVERSAL_INTERVAL_US = 1000L * 50; // 50ms
|
static const int64_t LOOP_TRAVERSAL_INTERVAL_US = 1000L * 50; // 50ms
|
||||||
// when freeze memtable base on needs less than TABLET_FREEZE_PERCENT,
|
// when freeze memtable base on needs less than TABLET_FREEZE_PERCENT,
|
||||||
|
|||||||
@ -141,4 +141,4 @@ int ObFreezeCheckpoint::finish_freeze()
|
|||||||
|
|
||||||
} // namespace checkpoint
|
} // namespace checkpoint
|
||||||
} // namespace storage
|
} // namespace storage
|
||||||
} // namespace oceanbase
|
} // namespace oceanbase
|
||||||
|
|||||||
Reference in New Issue
Block a user