fix migrate lob tablets issue
This commit is contained in:
		| @ -223,6 +223,7 @@ int ObTabletBindingHelper::set_scn_for_create(const ObBatchCreateTabletArg &arg, | |||||||
|       if (OB_FAIL(helper.set_scn(info.data_tablet_id_))) { |       if (OB_FAIL(helper.set_scn(info.data_tablet_id_))) { | ||||||
|         LOG_WARN("failed to set log ts for orig tablet", K(ret)); |         LOG_WARN("failed to set log ts for orig tablet", K(ret)); | ||||||
|       } |       } | ||||||
|  |  | ||||||
|       for (int64_t j = 0; OB_SUCC(ret) && j < info.tablet_ids_.count(); ++j) { |       for (int64_t j = 0; OB_SUCC(ret) && j < info.tablet_ids_.count(); ++j) { | ||||||
|         int64_t aux_idx = -1; |         int64_t aux_idx = -1; | ||||||
|         if (ObTabletCreateDeleteHelper::find_related_aux_info(arg, info.tablet_ids_.at(j), aux_idx) |         if (ObTabletCreateDeleteHelper::find_related_aux_info(arg, info.tablet_ids_.at(j), aux_idx) | ||||||
| @ -253,6 +254,7 @@ int ObTabletBindingHelper::unlock_tablet_binding_for_create(const ObBatchCreateT | |||||||
|       if (OB_FAIL(helper.unlock_tablet_binding(info.data_tablet_id_))) { |       if (OB_FAIL(helper.unlock_tablet_binding(info.data_tablet_id_))) { | ||||||
|         LOG_WARN("failed to lock tablet binding", K(ret)); |         LOG_WARN("failed to lock tablet binding", K(ret)); | ||||||
|       } |       } | ||||||
|  |  | ||||||
|       for (int64_t j = 0; OB_SUCC(ret) && j < info.tablet_ids_.count(); ++j) { |       for (int64_t j = 0; OB_SUCC(ret) && j < info.tablet_ids_.count(); ++j) { | ||||||
|         int64_t aux_idx = -1; |         int64_t aux_idx = -1; | ||||||
|         if (ObTabletCreateDeleteHelper::find_related_aux_info(arg, info.tablet_ids_.at(j), aux_idx) |         if (ObTabletCreateDeleteHelper::find_related_aux_info(arg, info.tablet_ids_.at(j), aux_idx) | ||||||
| @ -269,7 +271,7 @@ int ObTabletBindingHelper::unlock_tablet_binding_for_create(const ObBatchCreateT | |||||||
|   return ret; |   return ret; | ||||||
| } | } | ||||||
|  |  | ||||||
| // bind aux and hidden tablets to non-creating data tablet | // bind aux and hidden tablets to creating and non-creating data tablet | ||||||
| int ObTabletBindingHelper::modify_tablet_binding_for_create( | int ObTabletBindingHelper::modify_tablet_binding_for_create( | ||||||
|     const ObBatchCreateTabletArg &arg, |     const ObBatchCreateTabletArg &arg, | ||||||
|     ObLS &ls, |     ObLS &ls, | ||||||
| @ -277,25 +279,14 @@ int ObTabletBindingHelper::modify_tablet_binding_for_create( | |||||||
| { | { | ||||||
|   int ret = OB_SUCCESS; |   int ret = OB_SUCCESS; | ||||||
|   ObArray<ObTabletID> empty_array; |   ObArray<ObTabletID> empty_array; | ||||||
|   ObSArray<int64_t> skip_idx; |  | ||||||
|   ObTabletBindingHelper helper(ls, trans_flags); |   ObTabletBindingHelper helper(ls, trans_flags); | ||||||
|   for (int64_t i = 0; OB_SUCC(ret) && i < arg.tablets_.count(); i++) { |   for (int64_t i = 0; OB_SUCC(ret) && i < arg.tablets_.count(); i++) { | ||||||
|     const ObCreateTabletInfo &info = arg.tablets_[i]; |     const ObCreateTabletInfo &info = arg.tablets_[i]; | ||||||
|     bool need_modify = false; |     bool need_modify = false; | ||||||
|     bool tablet_ids_as_aux_tablets = false; |     bool tablet_ids_as_aux_tablets = false; | ||||||
|     if (is_contain(skip_idx, i)) { |     if (ObTabletCreateDeleteHelper::is_pure_hidden_tablets(info)) { | ||||||
|       // do nothing |  | ||||||
|     } else if (ObTabletCreateDeleteHelper::is_pure_hidden_tablets(info)) { |  | ||||||
|       need_modify = true; |       need_modify = true; | ||||||
|       // tablet_ids_as_aux_tablets = false; |     } else if (ObTabletCreateDeleteHelper::is_pure_aux_tablets(info) || ObTabletCreateDeleteHelper::is_mixed_tablets(info)) { | ||||||
|       for (int64_t j = 0; OB_SUCC(ret) && j < info.tablet_ids_.count(); ++j) { |  | ||||||
|         int64_t aux_idx = -1; |  | ||||||
|         if (ObTabletCreateDeleteHelper::find_related_aux_info(arg, info.tablet_ids_.at(j), aux_idx) |  | ||||||
|             && OB_FAIL(skip_idx.push_back(aux_idx))) { |  | ||||||
|           LOG_WARN("failed to push related aux idx", K(ret), K(aux_idx)); |  | ||||||
|         } |  | ||||||
|       } |  | ||||||
|     } else if (ObTabletCreateDeleteHelper::is_pure_aux_tablets(info)) { |  | ||||||
|       if (has_lob_tablets(arg, info)) { |       if (has_lob_tablets(arg, info)) { | ||||||
|         need_modify = true; |         need_modify = true; | ||||||
|         tablet_ids_as_aux_tablets = true; |         tablet_ids_as_aux_tablets = true; | ||||||
| @ -469,9 +460,9 @@ int ObTabletBindingHelper::check_skip_tx_end(const ObTabletID &tablet_id, const | |||||||
|   ObTabletTxMultiSourceDataUnit tx_data; |   ObTabletTxMultiSourceDataUnit tx_data; | ||||||
|   ObTabletBindingHelper helper(ls, trans_flags); |   ObTabletBindingHelper helper(ls, trans_flags); | ||||||
|  |  | ||||||
|   if (SCN::invalid_scn() == trans_flags.scn_) { |   if (!trans_flags.scn_.is_valid()) { | ||||||
|     ret = OB_INVALID_ARGUMENT; |     ret = OB_INVALID_ARGUMENT; | ||||||
|     LOG_WARN("invalid args", K(ret), K(tablet_id), K(ls)); |     LOG_WARN("invalid args", K(ret), K(tablet_id), K(trans_flags)); | ||||||
|   } else if (OB_FAIL(helper.get_tablet(tablet_id, tablet_handle))) { |   } else if (OB_FAIL(helper.get_tablet(tablet_id, tablet_handle))) { | ||||||
|     if (OB_NO_NEED_UPDATE == ret) { |     if (OB_NO_NEED_UPDATE == ret) { | ||||||
|       skip = true; |       skip = true; | ||||||
| @ -564,22 +555,12 @@ int ObTabletBindingHelper::fix_binding_info_for_create_tablets(const ObBatchCrea | |||||||
| { | { | ||||||
|   int ret = OB_SUCCESS; |   int ret = OB_SUCCESS; | ||||||
|   // fix data_tablet binding_info for pure_aux_table |   // fix data_tablet binding_info for pure_aux_table | ||||||
|   ObSArray<int64_t> skip_idx; |  | ||||||
|   for (int64_t i = 0; OB_SUCC(ret) && i < arg.tablets_.count(); i++) { |   for (int64_t i = 0; OB_SUCC(ret) && i < arg.tablets_.count(); i++) { | ||||||
|     const ObCreateTabletInfo &info = arg.tablets_[i]; |     const ObCreateTabletInfo &info = arg.tablets_[i]; | ||||||
|     bool need_modify = false; |     bool need_modify = false; | ||||||
|     if (is_contain(skip_idx, i)) { |     if (ObTabletCreateDeleteHelper::is_pure_hidden_tablets(info)) { | ||||||
|       // do nothing |  | ||||||
|     } else if (ObTabletCreateDeleteHelper::is_pure_hidden_tablets(info)) { |  | ||||||
|       need_modify = true; |       need_modify = true; | ||||||
|       for (int64_t j = 0; OB_SUCC(ret) && j < info.tablet_ids_.count(); ++j) { |     } else if (ObTabletCreateDeleteHelper::is_pure_aux_tablets(info) || ObTabletCreateDeleteHelper::is_mixed_tablets(info)) { | ||||||
|         int64_t aux_idx = -1; |  | ||||||
|         if (ObTabletCreateDeleteHelper::find_related_aux_info(arg, info.tablet_ids_.at(j), aux_idx) |  | ||||||
|             && OB_FAIL(skip_idx.push_back(aux_idx))) { |  | ||||||
|           LOG_WARN("failed to push related aux idx", K(ret), K(aux_idx)); |  | ||||||
|         } |  | ||||||
|       } |  | ||||||
|     } else if (ObTabletCreateDeleteHelper::is_pure_aux_tablets(info)) { |  | ||||||
|       if (has_lob_tablets(arg, info)) { |       if (has_lob_tablets(arg, info)) { | ||||||
|         need_modify = true; |         need_modify = true; | ||||||
|       } |       } | ||||||
|  | |||||||
| @ -738,27 +738,18 @@ int ObTabletCreateDeleteHelper::do_tx_end_create_tablets( | |||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   // modify data_tablet status_info and binding_info for pure_aux_table |   // modify data_tablet status_info and binding_info | ||||||
|   ObSArray<int64_t> skip_idx; |  | ||||||
|   for (int64_t i = 0; OB_SUCC(ret) && i < arg.tablets_.count(); i++) { |   for (int64_t i = 0; OB_SUCC(ret) && i < arg.tablets_.count(); i++) { | ||||||
|     const ObCreateTabletInfo &info = arg.tablets_[i]; |     const ObCreateTabletInfo &info = arg.tablets_[i]; | ||||||
|     bool need_modify = false; |     bool need_modify = false; | ||||||
|     if (is_contain(skip_idx, i)) { |     if (is_pure_hidden_tablets(info)) { | ||||||
|       // do nothing |  | ||||||
|     } else if (is_pure_hidden_tablets(info)) { |  | ||||||
|       need_modify = true; |       need_modify = true; | ||||||
|       for (int64_t j = 0; OB_SUCC(ret) && j < info.tablet_ids_.count(); ++j) { |     } else if (is_pure_aux_tablets(info) || is_mixed_tablets(info)) { | ||||||
|         int64_t aux_idx = -1; |  | ||||||
|         if (find_related_aux_info(arg, info.tablet_ids_.at(j), aux_idx) |  | ||||||
|             && OB_FAIL(skip_idx.push_back(aux_idx))) { |  | ||||||
|           LOG_WARN("failed to push related aux idx", K(ret), K(aux_idx)); |  | ||||||
|         } |  | ||||||
|       } |  | ||||||
|     } else if (is_pure_aux_tablets(info)) { |  | ||||||
|       if (ObTabletBindingHelper::has_lob_tablets(arg, info)) { |       if (ObTabletBindingHelper::has_lob_tablets(arg, info)) { | ||||||
|         need_modify = true; |         need_modify = true; | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     if (OB_SUCC(ret) && need_modify) { |     if (OB_SUCC(ret) && need_modify) { | ||||||
|       bool skip = false; |       bool skip = false; | ||||||
|       if (trans_flags.for_replay_ |       if (trans_flags.for_replay_ | ||||||
| @ -1496,25 +1487,6 @@ int ObTabletCreateDeleteHelper::create_sstable( | |||||||
|   return ret; |   return ret; | ||||||
| } | } | ||||||
|  |  | ||||||
| int ObTabletCreateDeleteHelper::verify_tablets_existence( |  | ||||||
|     const ObBatchCreateTabletArg &arg, |  | ||||||
|     ObIArray<ObTabletCreateInfo> &tablet_create_info_array) |  | ||||||
| { |  | ||||||
|   int ret = OB_SUCCESS; |  | ||||||
|   bool is_valid = false; |  | ||||||
|  |  | ||||||
|   if (OB_FAIL(check_tablet_existence(arg, is_valid))) { |  | ||||||
|     LOG_WARN("failed to check tablet existence", K(ret), K(PRINT_CREATE_ARG(arg))); |  | ||||||
|   } else if (!is_valid) { |  | ||||||
|     ret = OB_ERR_UNEXPECTED; |  | ||||||
|     LOG_WARN("unexpected error, some tablet does not exist", K(ret)); |  | ||||||
|   } else if (OB_FAIL(build_tablet_create_info(arg, tablet_create_info_array))) { |  | ||||||
|     LOG_WARN("failed to build tablet create info", K(ret)); |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   return ret; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| int ObTabletCreateDeleteHelper::verify_tablets_absence( | int ObTabletCreateDeleteHelper::verify_tablets_absence( | ||||||
|     const ObBatchCreateTabletArg &arg, |     const ObBatchCreateTabletArg &arg, | ||||||
|     ObIArray<ObTabletCreateInfo> &tablet_create_info_array) |     ObIArray<ObTabletCreateInfo> &tablet_create_info_array) | ||||||
|  | |||||||
| @ -151,9 +151,6 @@ public: | |||||||
|  |  | ||||||
|   static int prepare_data_for_binding_info(const ObTabletID &tablet_id, const ObLS &ls, const transaction::ObMulSourceDataNotifyArg &trans_flags); |   static int prepare_data_for_binding_info(const ObTabletID &tablet_id, const ObLS &ls, const transaction::ObMulSourceDataNotifyArg &trans_flags); | ||||||
| private: | private: | ||||||
|   static int verify_tablets_existence( |  | ||||||
|       const obrpc::ObBatchCreateTabletArg &arg, |  | ||||||
|       common::ObIArray<ObTabletCreateInfo> &tablet_create_info_array); |  | ||||||
|   static int verify_tablets_absence( |   static int verify_tablets_absence( | ||||||
|       const obrpc::ObBatchCreateTabletArg &arg, |       const obrpc::ObBatchCreateTabletArg &arg, | ||||||
|       common::ObIArray<ObTabletCreateInfo> &tablet_create_info_array); |       common::ObIArray<ObTabletCreateInfo> &tablet_create_info_array); | ||||||
|  | |||||||
| @ -285,12 +285,16 @@ int ObTabletMeta::init( | |||||||
|     if (OB_NOT_NULL(tablet_meta) && tablet_meta->clog_checkpoint_scn_ > old_tablet_meta.clog_checkpoint_scn_) { |     if (OB_NOT_NULL(tablet_meta) && tablet_meta->clog_checkpoint_scn_ > old_tablet_meta.clog_checkpoint_scn_) { | ||||||
|       if (OB_FAIL(autoinc_seq_.assign(tablet_meta->autoinc_seq_))) { |       if (OB_FAIL(autoinc_seq_.assign(tablet_meta->autoinc_seq_))) { | ||||||
|         LOG_WARN("failed to assign autoinc seq", K(ret)); |         LOG_WARN("failed to assign autoinc seq", K(ret)); | ||||||
|  |       } else if (OB_FAIL(ddl_data_.assign(tablet_meta->ddl_data_))) { | ||||||
|  |         LOG_WARN("failed to assign ddl data", K(ret)); | ||||||
|       } else { |       } else { | ||||||
|         tx_data_ = tablet_meta->tx_data_; |         tx_data_ = tablet_meta->tx_data_; | ||||||
|       } |       } | ||||||
|     } else { |     } else { | ||||||
|       if (OB_FAIL(autoinc_seq_.assign(autoinc_seq))) { |       if (OB_FAIL(autoinc_seq_.assign(autoinc_seq))) { | ||||||
|         LOG_WARN("failed to assign autoinc seq", K(ret)); |         LOG_WARN("failed to assign autoinc seq", K(ret)); | ||||||
|  |       } else if (OB_FAIL(ddl_data_.assign(ddl_data))) { | ||||||
|  |         LOG_WARN("failed to assign ddl data", K(ret)); | ||||||
|       } else { |       } else { | ||||||
|         tx_data_ = tx_data; |         tx_data_ = tx_data; | ||||||
|       } |       } | ||||||
| @ -309,9 +313,6 @@ int ObTabletMeta::init( | |||||||
|     compat_mode_ = old_tablet_meta.compat_mode_; |     compat_mode_ = old_tablet_meta.compat_mode_; | ||||||
|     ha_status_ = old_tablet_meta.ha_status_; |     ha_status_ = old_tablet_meta.ha_status_; | ||||||
|     report_status_ = old_tablet_meta.report_status_; //old tablet meta report status already reset |     report_status_ = old_tablet_meta.report_status_; //old tablet meta report status already reset | ||||||
|     if (FAILEDx(ddl_data_.assign(ddl_data))) { |  | ||||||
|       LOG_WARN("failed to assign ddl data", K(ret)); |  | ||||||
|     } |  | ||||||
|     table_store_flag_ = table_store_flag; |     table_store_flag_ = table_store_flag; | ||||||
|     ddl_checkpoint_scn_ = old_tablet_meta.ddl_checkpoint_scn_; |     ddl_checkpoint_scn_ = old_tablet_meta.ddl_checkpoint_scn_; | ||||||
|     ddl_start_scn_ = old_tablet_meta.ddl_start_scn_; |     ddl_start_scn_ = old_tablet_meta.ddl_start_scn_; | ||||||
|  | |||||||
| @ -87,6 +87,9 @@ int TestLobCommon::create_data_tablet( | |||||||
|     } else if (OB_FAIL(ls->get_tablet_svr()->on_redo_create_tablets(arg, trans_flags))) { |     } else if (OB_FAIL(ls->get_tablet_svr()->on_redo_create_tablets(arg, trans_flags))) { | ||||||
|       STORAGE_LOG(WARN, "failed to redo create tablets", K(ret), K(arg)); |       STORAGE_LOG(WARN, "failed to redo create tablets", K(ret), K(arg)); | ||||||
|     } else if (FALSE_IT(trans_flags.scn_ = share::SCN::plus(trans_flags.scn_, 1))) { |     } else if (FALSE_IT(trans_flags.scn_ = share::SCN::plus(trans_flags.scn_, 1))) { | ||||||
|  |     } else if (OB_FAIL(ls->get_tablet_svr()->on_tx_end_create_tablets(arg, trans_flags))) { | ||||||
|  |       STORAGE_LOG(WARN, "failed to tx end create tablets", K(ret), K(arg)); | ||||||
|  |     } else if (FALSE_IT(trans_flags.scn_ = share::SCN::plus(trans_flags.scn_, 1))) { | ||||||
|     } else if (OB_FAIL(ls->get_tablet_svr()->on_commit_create_tablets(arg, trans_flags))) { |     } else if (OB_FAIL(ls->get_tablet_svr()->on_commit_create_tablets(arg, trans_flags))) { | ||||||
|       STORAGE_LOG(WARN, "failed to commit create tablets", K(ret), K(arg)); |       STORAGE_LOG(WARN, "failed to commit create tablets", K(ret), K(arg)); | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -45,6 +45,9 @@ int TestTabletHelper::create_tablet(ObLSTabletService &ls_tablet_svr, obrpc::ObB | |||||||
|   } else if (OB_FAIL(ls_tablet_svr.on_redo_create_tablets(arg, trans_flags))) { |   } else if (OB_FAIL(ls_tablet_svr.on_redo_create_tablets(arg, trans_flags))) { | ||||||
|     STORAGE_LOG(WARN, "failed to redo create tablets", K(ret), K(arg)); |     STORAGE_LOG(WARN, "failed to redo create tablets", K(ret), K(arg)); | ||||||
|   } else if (FALSE_IT(trans_flags.scn_ = share::SCN::plus(trans_flags.scn_, 1))) { |   } else if (FALSE_IT(trans_flags.scn_ = share::SCN::plus(trans_flags.scn_, 1))) { | ||||||
|  |   } else if (OB_FAIL(ls_tablet_svr.on_tx_end_create_tablets(arg, trans_flags))) { | ||||||
|  |     STORAGE_LOG(WARN, "failed to tx end create tablets", K(ret), K(arg)); | ||||||
|  |   } else if (FALSE_IT(trans_flags.scn_ = share::SCN::plus(trans_flags.scn_, 1))) { | ||||||
|   } else if (OB_FAIL(ls_tablet_svr.on_commit_create_tablets(arg, trans_flags))) { |   } else if (OB_FAIL(ls_tablet_svr.on_commit_create_tablets(arg, trans_flags))) { | ||||||
|     STORAGE_LOG(WARN, "failed to commit create tablets", K(ret), K(arg)); |     STORAGE_LOG(WARN, "failed to commit create tablets", K(ret), K(arg)); | ||||||
|   } |   } | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 hiddenbomb
					hiddenbomb