adjust clog_checkpoint lock read_prefer
This commit is contained in:
		| @ -29,7 +29,7 @@ namespace checkpoint | ||||
| { | ||||
|  | ||||
| ObCheckpointExecutor::ObCheckpointExecutor() | ||||
|     : rwlock_(common::ObLatchIds::CLOG_CKPT_LOCK), | ||||
|     : rwlock_(common::ObLatchIds::CLOG_CKPT_RWLOCK), | ||||
|       update_checkpoint_enabled_(false) | ||||
| { | ||||
|   reset(); | ||||
|  | ||||
| @ -421,7 +421,7 @@ SCN ObLSTxService::get_rec_scn() | ||||
|   SCN min_rec_scn = SCN::max_scn(); | ||||
|   int min_rec_scn_common_checkpoint_type_index = 0; | ||||
|   char common_checkpoint_type[common::MAX_CHECKPOINT_TYPE_BUF_LENGTH]; | ||||
|   ObSpinLockGuard guard(lock_); | ||||
|   RLockGuard guard(rwlock_); | ||||
|   for (int i = 1; i < ObCommonCheckpointType::MAX_BASE_TYPE; i++) { | ||||
|     if (OB_NOT_NULL(common_checkpoints_[i])) { | ||||
|       SCN rec_scn = common_checkpoints_[i]->get_rec_scn(); | ||||
| @ -446,7 +446,7 @@ int ObLSTxService::flush(SCN &recycle_scn) | ||||
| { | ||||
|   int ret = OB_SUCCESS; | ||||
|   int tmp_ret = OB_SUCCESS; | ||||
|   ObSpinLockGuard guard(lock_); | ||||
|   RLockGuard guard(rwlock_); | ||||
|   for (int i = 1; i < ObCommonCheckpointType::MAX_BASE_TYPE; i++) { | ||||
|     // only flush the common_checkpoint that whose clog need recycle | ||||
|     if (OB_NOT_NULL(common_checkpoints_[i]) && recycle_scn >= common_checkpoints_[i]->get_rec_scn()) { | ||||
| @ -480,7 +480,7 @@ int ObLSTxService::get_common_checkpoint_info( | ||||
| { | ||||
|   int ret = OB_SUCCESS; | ||||
|   common_checkpoint_array.reset(); | ||||
|   ObSpinLockGuard guard(lock_); | ||||
|   RLockGuard guard(rwlock_); | ||||
|   for (int i = 1; i < ObCommonCheckpointType::MAX_BASE_TYPE; i++) { | ||||
|     ObCommonCheckpoint *common_checkpoint = common_checkpoints_[i]; | ||||
|     if (OB_ISNULL(common_checkpoint)) { | ||||
| @ -507,7 +507,7 @@ int ObLSTxService::register_common_checkpoint(const ObCommonCheckpointType &type | ||||
|     ret = OB_INVALID_ARGUMENT; | ||||
|     STORAGE_LOG(WARN, "invalid arguments", K(ret), K(type), K(common_checkpoint)); | ||||
|   } else { | ||||
|     ObSpinLockGuard guard(lock_); | ||||
|     WLockGuard guard(rwlock_); | ||||
|     if (OB_NOT_NULL(common_checkpoints_[type])) { | ||||
|       STORAGE_LOG(WARN, "repeat register common_checkpoint", K(ret), K(type), K(common_checkpoint)); | ||||
|     } else { | ||||
| @ -527,7 +527,7 @@ int ObLSTxService::unregister_common_checkpoint(const ObCommonCheckpointType &ty | ||||
|     ret = OB_INVALID_ARGUMENT; | ||||
|     STORAGE_LOG(WARN, "invalid arguments", K(ret), K(type), K(common_checkpoint)); | ||||
|   } else { | ||||
|     ObSpinLockGuard guard(lock_); | ||||
|     WLockGuard guard(rwlock_); | ||||
|     if (OB_ISNULL(common_checkpoints_[type])) { | ||||
|       STORAGE_LOG(WARN, "common_checkpoint is null, no need unregister", K(type), | ||||
|                   K(common_checkpoint)); | ||||
| @ -559,7 +559,7 @@ int ObLSTxService::traversal_flush() | ||||
| { | ||||
|   int ret = OB_SUCCESS; | ||||
|   int tmp_ret = OB_SUCCESS; | ||||
|   ObSpinLockGuard guard(lock_); | ||||
|   RLockGuard guard(rwlock_); | ||||
|   for (int i = 1; i < ObCommonCheckpointType::MAX_BASE_TYPE; i++) { | ||||
|     if (OB_NOT_NULL(common_checkpoints_[i]) && | ||||
|         OB_SUCCESS != (tmp_ret = common_checkpoints_[i]->flush(SCN::max_scn(), false))) { | ||||
| @ -570,7 +570,7 @@ int ObLSTxService::traversal_flush() | ||||
| } | ||||
|  | ||||
| void ObLSTxService::reset_() { | ||||
|   ObSpinLockGuard guard(lock_); | ||||
|   WLockGuard guard(rwlock_); | ||||
|   for (int i = 0; i < ObCommonCheckpointType::MAX_BASE_TYPE; i++) { | ||||
|     common_checkpoints_[i] = NULL; | ||||
|   } | ||||
|  | ||||
| @ -14,7 +14,7 @@ | ||||
| #define OCEANBASE_TRANSACTION_OB_LS_TX_SERVICE | ||||
|  | ||||
| #include "lib/ob_errno.h" | ||||
| #include "lib/lock/ob_spin_lock.h" | ||||
| #include "lib/lock/ob_spin_rwlock.h"           // SpinRWLock | ||||
| #include "share/ob_ls_id.h" | ||||
| #include "storage/checkpoint/ob_common_checkpoint.h" | ||||
| #include "storage/ob_i_store.h" | ||||
| @ -62,7 +62,7 @@ public: | ||||
|         ls_id_(), | ||||
|         mgr_(NULL), | ||||
|         trans_service_(NULL), | ||||
|         lock_(common::ObLatchIds::CLOG_CKPT_LOCK) { | ||||
|         rwlock_(common::ObLatchIds::CLOG_CKPT_RWLOCK) { | ||||
|     reset_(); | ||||
|   } | ||||
|   ~ObLSTxService() {} | ||||
| @ -177,7 +177,10 @@ private: | ||||
|  | ||||
|   // responsible for maintenance checkpoint unit that write TRANS_SERVICE_LOG_BASE_TYPE clog | ||||
|   checkpoint::ObCommonCheckpoint *common_checkpoints_[checkpoint::ObCommonCheckpointType::MAX_BASE_TYPE]; | ||||
|   common::ObSpinLock lock_; | ||||
|   typedef common::SpinRWLock RWLock; | ||||
|   typedef common::SpinRLockGuard  RLockGuard; | ||||
|   typedef common::SpinWLockGuard  WLockGuard; | ||||
|   RWLock rwlock_; | ||||
| }; | ||||
|  | ||||
| } | ||||
|  | ||||
| @ -826,6 +826,8 @@ int ObLockMemtable::flush(SCN recycle_scn, | ||||
|         if (OB_EAGAIN != ret && OB_SIZE_OVERFLOW != ret) { | ||||
|           LOG_WARN("failed to schedule lock_memtable merge dag", K(ret), K(this)); | ||||
|         } | ||||
|       } else { | ||||
|         LOG_INFO("schedule lock_memtable merge_dag successfully", K(ls_id_), K(freeze_scn_)); | ||||
|       } | ||||
|     } | ||||
|   } | ||||
|  | ||||
| @ -648,8 +648,8 @@ int ObOBJLock::get_table_lock_store_info( | ||||
|     ObTableLockOpList *op_list = map_[i]; | ||||
|     if (op_list != NULL) { | ||||
|       DLIST_FOREACH(curr, *op_list) { | ||||
|         if (curr->lock_op_.commit_scn_ <= freeze_scn | ||||
|             && curr->is_complete_outtrans_lock()) { | ||||
|         if (curr->lock_op_.commit_scn_ <= freeze_scn && | ||||
|             (curr->is_complete_outtrans_lock() || curr->is_complete_outtrans_unlock())) { | ||||
|           ObTableLockOp store_info; | ||||
|           if(OB_FAIL(curr->get_table_lock_store_info(store_info))) { | ||||
|             LOG_WARN("get_table_lock_store_info failed", K(ret)); | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 obdev
					obdev