@@ -2476,39 +2476,55 @@ int ObBackupDataClean::get_sys_tenant_prepare_clog_round_and_piece(const share::
24762476 }
24772477 }
24782478 }
2479+
2480+ int piece_num = log_archive_round.piece_infos_ .count ();
24792481 if (OB_FAIL (ret)) {
24802482 } else if (ObLogArchiveStatus::STOP != log_archive_round.log_archive_status_ ) {
24812483 // do nothing
24822484 } else if (log_archive_round.checkpoint_ts_ > clog_gc_snapshot || log_archive_round.copies_num_ < backup_copies) {
24832485 is_delete_inorder = false ;
2484- } else if (OB_FAIL (log_archive_rounds.push_back (log_archive_round))) {
2485- LOG_WARN (" failed to push log archive round into array" , K (ret), K (log_archive_round));
2486+ } else if (piece_num < 0 ) {
2487+ ret = OB_ERR_UNEXPECTED;
2488+ LOG_WARN (" piece num is less than 0" , K (piece_num), K (log_archive_round));
24862489 } else {
2487- char trace_id[common::OB_MAX_TRACE_ID_BUFFER_SIZE] = " " ;
2488- int trace_length = 0 ;
2489- simple_archive_round.reset ();
2490- simple_archive_round.incarnation_ = clean_element.incarnation_ ;
2491- simple_archive_round.round_id_ = log_archive_round.log_archive_round_ ;
2492- simple_archive_round.copy_id_ = log_archive_round.copy_id_ ;
2493- if (OB_FAIL (sys_tenant_deleted_backup_round_.set_refactored_1 (simple_archive_round, overwrite_key))) {
2494- LOG_WARN (" failed to set sys tenant deleted backup round" , K (ret), K (simple_archive_round));
2495- } else if (FALSE_IT (trace_length = ObCurTraceId::get_trace_id ()->to_string (
2496- trace_id, common::OB_MAX_TRACE_ID_BUFFER_SIZE))) {
2497- } else if (trace_length > OB_MAX_TRACE_ID_BUFFER_SIZE) {
2498- ret = OB_ERR_UNEXPECTED;
2499- LOG_WARN (" failed to get trace id" , K (ret), K (*ObCurTraceId::get_trace_id ()));
2490+ if (0 == piece_num) {
2491+ is_delete_inorder = true ;
25002492 } else {
2501- FLOG_INFO (" [BACKUP_CLEAN]succ add backup clean round" , K (simple_archive_round), K (clean_info));
2502- ROOTSERVICE_EVENT_ADD (" backup_clean" ,
2503- " backup_round" ,
2504- " tenant_id" ,
2505- clean_info.tenant_id_ ,
2506- " round_id" ,
2507- simple_archive_round.round_id_ ,
2508- " copy_id" ,
2509- simple_archive_round.copy_id_ ,
2510- " trace_id" ,
2511- trace_id);
2493+ const ObSimplePieceInfo &simple_piece_info = log_archive_round.piece_infos_ .at (piece_num - 1 );
2494+ if (simple_piece_info.max_ts_ > clog_gc_snapshot) {
2495+ is_delete_inorder = false ;
2496+ }
2497+ }
2498+ if (!is_delete_inorder) {
2499+ } else if (OB_FAIL (log_archive_rounds.push_back (log_archive_round))) {
2500+ LOG_WARN (" failed to push log archive round into array" , K (ret), K (log_archive_round));
2501+ } else {
2502+ char trace_id[common::OB_MAX_TRACE_ID_BUFFER_SIZE] = " " ;
2503+ int trace_length = 0 ;
2504+ simple_archive_round.reset ();
2505+ simple_archive_round.incarnation_ = clean_element.incarnation_ ;
2506+ simple_archive_round.round_id_ = log_archive_round.log_archive_round_ ;
2507+ simple_archive_round.copy_id_ = log_archive_round.copy_id_ ;
2508+ if (OB_FAIL (sys_tenant_deleted_backup_round_.set_refactored_1 (simple_archive_round, overwrite_key))) {
2509+ LOG_WARN (" failed to set sys tenant deleted backup round" , K (ret), K (simple_archive_round));
2510+ } else if (FALSE_IT (trace_length = ObCurTraceId::get_trace_id ()->to_string (
2511+ trace_id, common::OB_MAX_TRACE_ID_BUFFER_SIZE))) {
2512+ } else if (trace_length > OB_MAX_TRACE_ID_BUFFER_SIZE) {
2513+ ret = OB_ERR_UNEXPECTED;
2514+ LOG_WARN (" failed to get trace id" , K (ret), K (*ObCurTraceId::get_trace_id ()));
2515+ } else {
2516+ FLOG_INFO (" [BACKUP_CLEAN]succ add backup clean round" , K (simple_archive_round), K (clean_info));
2517+ ROOTSERVICE_EVENT_ADD (" backup_clean" ,
2518+ " backup_round" ,
2519+ " tenant_id" ,
2520+ clean_info.tenant_id_ ,
2521+ " round_id" ,
2522+ simple_archive_round.round_id_ ,
2523+ " copy_id" ,
2524+ simple_archive_round.copy_id_ ,
2525+ " trace_id" ,
2526+ trace_id);
2527+ }
25122528 }
25132529 }
25142530 }
0 commit comments