Fix replay finish transfer in log allow tablet not exist bug.
This commit is contained in:
		| @ -132,7 +132,8 @@ int ObTabletReplayExecutor::replay_get_tablet_( | |||||||
|   } else { |   } else { | ||||||
|     const share::ObLSID &ls_id = ls->get_ls_id(); |     const share::ObLSID &ls_id = ls->get_ls_id(); | ||||||
|     if (is_replay_update_tablet_status_()) { |     if (is_replay_update_tablet_status_()) { | ||||||
|       if (OB_FAIL(ls->replay_get_tablet_no_check(tablet_id, scn, tablet_handle))) { |       const bool allow_tablet_not_exist = replay_allow_tablet_not_exist_(); | ||||||
|  |       if (OB_FAIL(ls->replay_get_tablet_no_check(tablet_id, scn, allow_tablet_not_exist, tablet_handle))) { | ||||||
|         CLOG_LOG(WARN, "replay get table failed", KR(ret), K(ls_id), K(tablet_id)); |         CLOG_LOG(WARN, "replay get table failed", KR(ret), K(ls_id), K(tablet_id)); | ||||||
|       } |       } | ||||||
|     } else if (OB_FAIL(ls->replay_get_tablet(tablet_id, scn, is_update_mds_table, tablet_handle))) { |     } else if (OB_FAIL(ls->replay_get_tablet(tablet_id, scn, is_update_mds_table, tablet_handle))) { | ||||||
|  | |||||||
| @ -91,6 +91,8 @@ protected: | |||||||
|   // @return other error codes, failed to replay. |   // @return other error codes, failed to replay. | ||||||
|   virtual int replay_check_restore_status_(storage::ObTabletHandle &tablet_handle); |   virtual int replay_check_restore_status_(storage::ObTabletHandle &tablet_handle); | ||||||
|  |  | ||||||
|  |   virtual bool replay_allow_tablet_not_exist_() { return true; } | ||||||
|  |  | ||||||
|   // not allowed to pass ObTabletCreateDeleteMdsUserData or ObTabletBindingMdsUserData |   // not allowed to pass ObTabletCreateDeleteMdsUserData or ObTabletBindingMdsUserData | ||||||
|   template <typename T, |   template <typename T, | ||||||
|             typename U = typename std::enable_if< |             typename U = typename std::enable_if< | ||||||
|  | |||||||
| @ -149,7 +149,9 @@ int ObDDLStartReplayExecutor::do_replay_(ObTabletHandle &tablet_handle) | |||||||
|     LOG_WARN("get lob meta tablet id failed", K(ret)); |     LOG_WARN("get lob meta tablet id failed", K(ret)); | ||||||
|   } else if (lob_meta_tablet_id.is_valid()) { |   } else if (lob_meta_tablet_id.is_valid()) { | ||||||
|     ObTabletHandle lob_meta_tablet_handle; |     ObTabletHandle lob_meta_tablet_handle; | ||||||
|     if (OB_FAIL(ls_->replay_get_tablet_no_check(lob_meta_tablet_id, scn_, lob_meta_tablet_handle))) { |     const bool replay_allow_tablet_not_exist = true; | ||||||
|  |     if (OB_FAIL(ls_->replay_get_tablet_no_check(lob_meta_tablet_id, scn_, | ||||||
|  |         replay_allow_tablet_not_exist, lob_meta_tablet_handle))) { | ||||||
|       LOG_WARN("get tablet handle failed", K(ret), K(lob_meta_tablet_id), K(scn_)); |       LOG_WARN("get tablet handle failed", K(ret), K(lob_meta_tablet_id), K(scn_)); | ||||||
|     } else if (OB_FAIL(replay_ddl_start(lob_meta_tablet_handle, true/*is_lob_meta_tablet*/))) { |     } else if (OB_FAIL(replay_ddl_start(lob_meta_tablet_handle, true/*is_lob_meta_tablet*/))) { | ||||||
|       LOG_WARN("replay ddl start for lob meta tablet failed", K(ret), K(lob_meta_tablet_id), K(scn_)); |       LOG_WARN("replay ddl start for lob meta tablet failed", K(ret), K(lob_meta_tablet_id), K(scn_)); | ||||||
| @ -423,7 +425,9 @@ int ObDDLCommitReplayExecutor::do_replay_(ObTabletHandle &tablet_handle) | |||||||
|     LOG_WARN("get lob meta tablet id failed", K(ret)); |     LOG_WARN("get lob meta tablet id failed", K(ret)); | ||||||
|   } else if (lob_meta_tablet_id.is_valid()) { |   } else if (lob_meta_tablet_id.is_valid()) { | ||||||
|     ObTabletHandle lob_meta_tablet_handle; |     ObTabletHandle lob_meta_tablet_handle; | ||||||
|     if (OB_FAIL(ls_->replay_get_tablet_no_check(lob_meta_tablet_id, scn_, lob_meta_tablet_handle))) { |     const bool replay_allow_tablet_not_exist = true; | ||||||
|  |     if (OB_FAIL(ls_->replay_get_tablet_no_check(lob_meta_tablet_id, scn_, | ||||||
|  |         replay_allow_tablet_not_exist, lob_meta_tablet_handle))) { | ||||||
|       LOG_WARN("get tablet handle failed", K(ret), K(lob_meta_tablet_id), K(scn_)); |       LOG_WARN("get tablet handle failed", K(ret), K(lob_meta_tablet_id), K(scn_)); | ||||||
|     } else if (OB_FAIL(replay_ddl_commit(lob_meta_tablet_handle))) { |     } else if (OB_FAIL(replay_ddl_commit(lob_meta_tablet_handle))) { | ||||||
|       LOG_WARN("replay ddl start for lob meta tablet failed", K(ret), K(lob_meta_tablet_id), K(scn_)); |       LOG_WARN("replay ddl start for lob meta tablet failed", K(ret), K(lob_meta_tablet_id), K(scn_)); | ||||||
|  | |||||||
| @ -1694,6 +1694,7 @@ int ObLS::finish_slog_replay() | |||||||
| int ObLS::replay_get_tablet_no_check( | int ObLS::replay_get_tablet_no_check( | ||||||
|     const common::ObTabletID &tablet_id, |     const common::ObTabletID &tablet_id, | ||||||
|     const SCN &scn, |     const SCN &scn, | ||||||
|  |     const bool replay_allow_tablet_not_exist, | ||||||
|     ObTabletHandle &handle) const |     ObTabletHandle &handle) const | ||||||
| { | { | ||||||
|   int ret = OB_SUCCESS; |   int ret = OB_SUCCESS; | ||||||
| @ -1727,9 +1728,10 @@ int ObLS::replay_get_tablet_no_check( | |||||||
|       } else if (!max_scn.is_valid()) { |       } else if (!max_scn.is_valid()) { | ||||||
|         ret = OB_ERR_UNEXPECTED; |         ret = OB_ERR_UNEXPECTED; | ||||||
|         LOG_WARN("max_scn is invalid", KR(ret), K(key), K(scn), K(tablet_change_checkpoint_scn)); |         LOG_WARN("max_scn is invalid", KR(ret), K(key), K(scn), K(tablet_change_checkpoint_scn)); | ||||||
|       } else if (scn > SCN::scn_inc(max_scn)) { |       } else if (scn > SCN::scn_inc(max_scn) || !replay_allow_tablet_not_exist) { | ||||||
|         ret = OB_EAGAIN; |         ret = OB_EAGAIN; | ||||||
|         LOG_INFO("tablet does not exist, but need retry", KR(ret), K(key), K(scn), K(tablet_change_checkpoint_scn), K(max_scn)); |         LOG_INFO("tablet does not exist, but need retry", KR(ret), K(key), K(scn), | ||||||
|  |             K(tablet_change_checkpoint_scn), K(max_scn), K(replay_allow_tablet_not_exist)); | ||||||
|       } else { |       } else { | ||||||
|         ret = OB_OBSOLETE_CLOG_NEED_SKIP; |         ret = OB_OBSOLETE_CLOG_NEED_SKIP; | ||||||
|         LOG_INFO("tablet already gc, but scn is more than tablet_change_checkpoint_scn", KR(ret), |         LOG_INFO("tablet already gc, but scn is more than tablet_change_checkpoint_scn", KR(ret), | ||||||
| @ -1757,11 +1759,12 @@ int ObLS::replay_get_tablet( | |||||||
|   ObTablet *tablet = nullptr; |   ObTablet *tablet = nullptr; | ||||||
|   ObTabletCreateDeleteMdsUserData data; |   ObTabletCreateDeleteMdsUserData data; | ||||||
|   bool is_committed = false; |   bool is_committed = false; | ||||||
|  |   const bool replay_allow_tablet_not_exist = true; | ||||||
|  |  | ||||||
|   if (IS_NOT_INIT) { |   if (IS_NOT_INIT) { | ||||||
|     ret = OB_NOT_INIT; |     ret = OB_NOT_INIT; | ||||||
|     LOG_WARN("ls is not inited", KR(ret)); |     LOG_WARN("ls is not inited", KR(ret)); | ||||||
|   } else if (OB_FAIL(replay_get_tablet_no_check(tablet_id, scn, tablet_handle))) { |   } else if (OB_FAIL(replay_get_tablet_no_check(tablet_id, scn, replay_allow_tablet_not_exist, tablet_handle))) { | ||||||
|     LOG_WARN("failed to get tablet", K(ret), K(ls_id), K(tablet_id), K(scn)); |     LOG_WARN("failed to get tablet", K(ret), K(ls_id), K(tablet_id), K(scn)); | ||||||
|   } else if (tablet_id.is_ls_inner_tablet()) { |   } else if (tablet_id.is_ls_inner_tablet()) { | ||||||
|     // do nothing |     // do nothing | ||||||
|  | |||||||
| @ -380,6 +380,7 @@ public: | |||||||
|   int replay_get_tablet_no_check( |   int replay_get_tablet_no_check( | ||||||
|       const common::ObTabletID &tablet_id, |       const common::ObTabletID &tablet_id, | ||||||
|       const share::SCN &scn, |       const share::SCN &scn, | ||||||
|  |       const bool replay_allow_tablet_not_exist, | ||||||
|       ObTabletHandle &tablet_handle) const; |       ObTabletHandle &tablet_handle) const; | ||||||
|  |  | ||||||
|   int flush_if_need(const bool need_flush); |   int flush_if_need(const bool need_flush); | ||||||
|  | |||||||
| @ -175,7 +175,8 @@ int ObTabletBindingHelper::get_tablet_for_new_mds(const ObLS &ls, const ObTablet | |||||||
|   const ObTabletMapKey key(ls.get_ls_id(), tablet_id); |   const ObTabletMapKey key(ls.get_ls_id(), tablet_id); | ||||||
|   const bool for_replay = replay_scn.is_valid(); |   const bool for_replay = replay_scn.is_valid(); | ||||||
|   if (for_replay) { |   if (for_replay) { | ||||||
|     if (OB_FAIL(ls.replay_get_tablet_no_check(tablet_id, replay_scn, handle))) { |     const bool replay_allow_tablet_not_exist = true; | ||||||
|  |     if (OB_FAIL(ls.replay_get_tablet_no_check(tablet_id, replay_scn, replay_allow_tablet_not_exist, handle))) { | ||||||
|       if (OB_OBSOLETE_CLOG_NEED_SKIP == ret) { |       if (OB_OBSOLETE_CLOG_NEED_SKIP == ret) { | ||||||
|         ret = OB_NO_NEED_UPDATE; |         ret = OB_NO_NEED_UPDATE; | ||||||
|         LOG_WARN("clog is obsolete, should skip replay", K(ret)); |         LOG_WARN("clog is obsolete, should skip replay", K(ret)); | ||||||
|  | |||||||
| @ -148,6 +148,8 @@ protected: | |||||||
|     return true; |     return true; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  |   virtual bool replay_allow_tablet_not_exist_() { return false; } | ||||||
|  |  | ||||||
| private: | private: | ||||||
|   int check_src_transfer_tablet_(ObTabletHandle &tablet_handle); |   int check_src_transfer_tablet_(ObTabletHandle &tablet_handle); | ||||||
|  |  | ||||||
| @ -585,6 +587,7 @@ protected: | |||||||
|   { |   { | ||||||
|     return true; |     return true; | ||||||
|   } |   } | ||||||
|  |   virtual bool replay_allow_tablet_not_exist_() { return false; } | ||||||
|  |  | ||||||
| private: | private: | ||||||
|   int check_dest_transfer_tablet_(ObTabletHandle &tablet_handle); |   int check_dest_transfer_tablet_(ObTabletHandle &tablet_handle); | ||||||
|  | |||||||
| @ -68,6 +68,8 @@ protected: | |||||||
|     return true; |     return true; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  |   virtual bool replay_allow_tablet_not_exist_() { return false; } | ||||||
|  |  | ||||||
| private: | private: | ||||||
|   int check_src_transfer_tablet_(ObTabletHandle &tablet_handle); |   int check_src_transfer_tablet_(ObTabletHandle &tablet_handle); | ||||||
|  |  | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 godyangfight
					godyangfight