[GC] replace block_tx_start() with block_all() which blocks readonly transactions in addtion to write transactions

This commit is contained in:
yyy-hust
2023-09-09 10:44:30 +00:00
committed by ob-robot
parent 9e5ad47b75
commit 7695689b0a
3 changed files with 24 additions and 4 deletions

View File

@ -1394,6 +1394,25 @@ int ObLS::block_tx_start()
return ret;
}
int ObLS::block_all()
{
int ret = OB_SUCCESS;
if (IS_NOT_INIT) {
ret = OB_NOT_INIT;
LOG_WARN("ls is not inited", K(ret));
} else {
int64_t read_lock = 0;
int64_t write_lock = LSLOCKSTORAGE | LSLOCKTX;
ObLSLockGuard lock_myself(this, lock_, read_lock, write_lock);
// protect with lock_ to make sure there is no tablet transfer in process doing.
// transfer in must use this lock too.
if (OB_FAIL(ls_tx_svr_.block_all())) {
LOG_WARN("block_all failed", K(get_ls_id()));
}
}
return ret;
}
int ObLS::tablet_transfer_in(const ObTabletID &tablet_id)
{
int ret = OB_SUCCESS;