[CP] [4.0] retry lock in offline of tablet gc handler
This commit is contained in:
		@ -698,7 +698,8 @@ int ObLS::offline_()
 | 
				
			|||||||
    LOG_WARN("lock table offline failed", K(ret), K(ls_meta_));
 | 
					    LOG_WARN("lock table offline failed", K(ret), K(ls_meta_));
 | 
				
			||||||
  } else if (OB_FAIL(ls_tablet_svr_.offline())) {
 | 
					  } else if (OB_FAIL(ls_tablet_svr_.offline())) {
 | 
				
			||||||
    LOG_WARN("tablet service offline failed", K(ret), K(ls_meta_));
 | 
					    LOG_WARN("tablet service offline failed", K(ret), K(ls_meta_));
 | 
				
			||||||
  } else if (FALSE_IT(tablet_gc_handler_.offline())) {
 | 
					  } else if (OB_FAIL(tablet_gc_handler_.offline())) {
 | 
				
			||||||
 | 
					    LOG_WARN("tablet gc handler offline failed", K(ret), K(ls_meta_));
 | 
				
			||||||
  } else {
 | 
					  } else {
 | 
				
			||||||
    // do nothing
 | 
					    // do nothing
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
				
			|||||||
@ -435,11 +435,17 @@ int ObTabletGCHandler::gc_tablets(const common::ObTabletIDArray &tablet_ids)
 | 
				
			|||||||
  return ret;
 | 
					  return ret;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void ObTabletGCHandler::offline()
 | 
					int ObTabletGCHandler::offline()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					  int ret = OB_SUCCESS;
 | 
				
			||||||
  set_stop();
 | 
					  set_stop();
 | 
				
			||||||
  wait_stop();
 | 
					  if (!is_finish()) {
 | 
				
			||||||
  STORAGE_LOG(INFO, "tablet gc handler offline", KPC(this), KPC(ls_), K(ls_->get_ls_meta()));
 | 
					    ret = OB_EAGAIN;
 | 
				
			||||||
 | 
					    STORAGE_LOG(INFO, "tablet gc handler not finish, retry", KR(ret), KPC(this), KPC(ls_), K(ls_->get_ls_meta()));
 | 
				
			||||||
 | 
					  } else {
 | 
				
			||||||
 | 
					    STORAGE_LOG(INFO, "tablet gc handler offline", KPC(this), KPC(ls_), K(ls_->get_ls_meta()));
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  return ret;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void ObTabletGCHandler::online()
 | 
					void ObTabletGCHandler::online()
 | 
				
			||||||
 | 
				
			|||||||
@ -58,7 +58,7 @@ public:
 | 
				
			|||||||
                                 const int64_t checkpoint_ts);
 | 
					                                 const int64_t checkpoint_ts);
 | 
				
			||||||
  int gc_tablets(const common::ObTabletIDArray &tablet_ids);
 | 
					  int gc_tablets(const common::ObTabletIDArray &tablet_ids);
 | 
				
			||||||
  bool check_stop() { return ATOMIC_LOAD(&update_enabled_) == false; }
 | 
					  bool check_stop() { return ATOMIC_LOAD(&update_enabled_) == false; }
 | 
				
			||||||
  void offline();
 | 
					  int offline();
 | 
				
			||||||
  void online();
 | 
					  void online();
 | 
				
			||||||
  TO_STRING_KV(K_(tablet_persist_trigger), K_(is_inited));
 | 
					  TO_STRING_KV(K_(tablet_persist_trigger), K_(is_inited));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -68,7 +68,7 @@ private:
 | 
				
			|||||||
  int freeze_unpersist_tablet_ids(const common::ObTabletIDArray &unpersist_tablet_ids);
 | 
					  int freeze_unpersist_tablet_ids(const common::ObTabletIDArray &unpersist_tablet_ids);
 | 
				
			||||||
  int wait_unpersist_tablet_ids_flushed(const common::ObTabletIDArray &unpersist_tablet_ids,
 | 
					  int wait_unpersist_tablet_ids_flushed(const common::ObTabletIDArray &unpersist_tablet_ids,
 | 
				
			||||||
                                        const int64_t checkpoint_ts);
 | 
					                                        const int64_t checkpoint_ts);
 | 
				
			||||||
  void wait_stop() { obsys::ObWLockGuard lock(wait_lock_); }
 | 
					  bool is_finish() { obsys::ObWLockGuard lock(wait_lock_, false); return lock.acquired(); }
 | 
				
			||||||
  void set_stop() { ATOMIC_STORE(&update_enabled_, false); }
 | 
					  void set_stop() { ATOMIC_STORE(&update_enabled_, false); }
 | 
				
			||||||
  void set_start() { ATOMIC_STORE(&update_enabled_, true); }
 | 
					  void set_start() { ATOMIC_STORE(&update_enabled_, true); }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user