[bugfix] fix error log when accessing __all_virtual_ha_diagnose

This commit is contained in:
yyy-hust
2023-06-05 02:51:34 +00:00
committed by ob-robot
parent d627936f7d
commit 305786a690
7 changed files with 36 additions and 9 deletions

View File

@ -1212,6 +1212,22 @@ int ObSimpleLogClusterTestEnv::wait_lsn_until_flushed(const LSN &lsn, PalfHandle
return ret;
}
int ObSimpleLogClusterTestEnv::wait_lsn_until_submitted(const LSN &lsn, PalfHandleImplGuard &guard)
{
int ret = OB_SUCCESS;
int64_t print_log_time = OB_INVALID_TIMESTAMP;
LSN max_submit_end_lsn = guard.palf_handle_impl_->sw_.last_submit_end_lsn_;
while (lsn > max_submit_end_lsn) {
usleep(5 * 1000L);
if (palf_reach_time_interval(1 * 1000 * 1000L, print_log_time)) {
PALF_LOG(WARN, "wait_lsn_until_submitted", K(ret), K(max_submit_end_lsn), K(lsn));
}
max_submit_end_lsn = guard.palf_handle_impl_->sw_.last_submit_end_lsn_;
}
return ret;
}
void ObSimpleLogClusterTestEnv::wait_all_replcias_log_sync(const int64_t palf_id)
{
std::vector<PalfHandleImplGuard*> palf_list;

View File

@ -232,6 +232,8 @@ public:
virtual int get_palf_env(const int64_t server_idx, PalfEnv *&palf_env);
virtual int wait_until_has_committed(PalfHandleImplGuard &leader, const LSN &lsn);
virtual int wait_lsn_until_flushed(const LSN &lsn, PalfHandleImplGuard &guard);
//wait until all log task pushed into queue of LogIOWorker
virtual int wait_lsn_until_submitted(const LSN &lsn, PalfHandleImplGuard &guard);
virtual void wait_all_replcias_log_sync(const int64_t palf_id);
int get_middle_scn(const int64_t log_num, PalfHandleImplGuard &leader, share::SCN &mid_scn, LogEntryHeader &log_entry_header);
void switch_append_to_raw_write(PalfHandleImplGuard &leader, int64_t &mode_version);

View File

@ -48,7 +48,7 @@ TEST_F(TestObSimpleLogClusterLogThrottling, test_throttling_sys)
SET_CASE_LOG_FILE(TEST_NAME, "log_throttling_sys_log_stream");
int ret = OB_SUCCESS;
const int64_t id = 1;
PALF_LOG(INFO, "begin test throttlin_basic", K(id));
PALF_LOG(INFO, "begin test throttling_sy", K(id));
int64_t leader_idx = 0;
const int64_t CONFIG_CHANGE_TIMEOUT = 10 * 1000 * 1000L; // 10s
PalfHandleImplGuard leader;
@ -249,9 +249,9 @@ TEST_F(TestObSimpleLogClusterLogThrottling, test_throttling_basic)
ASSERT_EQ(5, throttle.handled_seq_);
leader.palf_handle_impl_->sw_.freeze_mode_ = PERIOD_FREEZE_MODE;
EXPECT_EQ(OB_SUCCESS, submit_log(leader, 10, id, 1 * MB));
//wait all flush log tasks pushed into queue of LogIOWorker
max_lsn_1 = leader.palf_handle_impl_->sw_.get_max_lsn();
usleep(1000 * 1000);
//wait all flush log tasks pushed into queue of LogIOWorker
wait_lsn_until_submitted(max_lsn_1, leader);
IOTaskCond io_task_cond_2(id, log_engine->palf_epoch_);
EXPECT_EQ(OB_SUCCESS, log_io_worker->submit_io_task(&io_task_cond_2));
ASSERT_EQ(7, throttle.submitted_seq_);

View File

@ -341,9 +341,9 @@ TEST_F(TestObSimpleLogThrottleArb, test_2f1a_throttling_minor_leader)
TEST_F(TestObSimpleLogThrottleArb, test_2f1a_throttling_minor_follower)
{
oceanbase::common::ObClusterVersion::get_instance().cluster_version_ = CLUSTER_VERSION_4_1_0_0;
SET_CASE_LOG_FILE(TEST_NAME, "arb_throttling_minor_leader");
SET_CASE_LOG_FILE(TEST_NAME, "arb_throttling_minor_follower");
int ret = OB_SUCCESS;
PALF_LOG(INFO, "begin arb_throttling_minor_leader");
PALF_LOG(INFO, "begin arb_throttling_minor_follower");
int64_t leader_idx = 0;
int64_t arb_replica_idx = -1;
PalfHandleImplGuard leader;
@ -403,8 +403,8 @@ TEST_F(TestObSimpleLogThrottleArb, test_2f1a_throttling_minor_follower)
usleep(LogWritingThrottle::UPDATE_INTERVAL_US);
ASSERT_EQ(OB_SUCCESS, submit_log(leader, 5, id, 1 * MB));
palf_env->palf_env_impl_.disk_options_wrapper_.disk_opts_for_stopping_writing_.log_disk_throttling_percentage_ = throttling_percentage;
usleep(LogWritingThrottle::UPDATE_INTERVAL_US);
//palf_env->palf_env_impl_.disk_options_wrapper_.disk_opts_for_stopping_writing_.log_disk_throttling_percentage_ = throttling_percentage;
// usleep(LogWritingThrottle::UPDATE_INTERVAL_US);
PALF_LOG(INFO, "[CASE 3.2] MINOR_FOLLOWER upgrade");
leader.palf_handle_impl_->sw_.freeze_mode_ = PERIOD_FREEZE_MODE;
palf_list[another_f_idx]->palf_handle_impl_->sw_.freeze_mode_ = PERIOD_FREEZE_MODE;

View File

@ -65,6 +65,7 @@ TEST_F(TestObSimpleLogIOWorkerThrottlingV2, test_throttling_majority)
loc_cb.leader_ = get_cluster()[leader_idx]->get_addr();
std::vector<PalfHandleImplGuard*> palf_list;
EXPECT_EQ(OB_SUCCESS, get_cluster_palf_handle_guard(id, palf_list));
ASSERT_EQ(5, palf_list.size());
const int64_t follower_B_idx = (leader_idx + 1);
const int64_t follower_C_idx = (leader_idx + 2);
@ -106,6 +107,8 @@ TEST_F(TestObSimpleLogIOWorkerThrottlingV2, test_throttling_majority)
ASSERT_EQ(OB_SUCCESS, submit_log(leader, 1, id, 512 * KB));
max_lsn = leader.palf_handle_impl_->sw_.get_max_lsn();
wait_lsn_until_flushed(max_lsn, leader);
wait_lsn_until_flushed(max_lsn, *palf_list[1]);
wait_lsn_until_flushed(max_lsn, *palf_list[2]);
int64_t break_ts = common::ObClockGenerator::getClock();
int64_t used_time = break_ts- cur_ts;
PALF_LOG(INFO, "[CASE 1] ", K(used_time));

View File

@ -106,6 +106,7 @@ public:
int64_t &paxos_replica_num,
common::GlobalLearnerList &learner_list) const = 0;
virtual int get_global_learner_list(common::GlobalLearnerList &learner_list) const = 0;
// get leader from election, used only for non_palf_leader rebuilding.
virtual int get_election_leader(common::ObAddr &addr) const = 0;
virtual int change_replica_num(const common::ObMemberList &member_list,
const int64_t curr_replica_num,
@ -322,7 +323,7 @@ public:
// @brief, get global learner list of this paxos group
// @param[out] common::GlobalLearnerList&
int get_global_learner_list(common::GlobalLearnerList &learner_list) const override final;
// @brief, get leader from election, used for non_palf_leader rebuilding
// @brief, get leader from election, used only for non_palf_leader rebuilding
// @param[out] addr: address of leader
// retval:
// OB_SUCCESS

View File

@ -29,7 +29,12 @@ int ObAllVirtualHADiagnose::inner_get_next_row(common::ObNewRow *&row)
int ret = OB_SUCCESS;
storage::DiagnoseInfo diagnose_info;
if (OB_FAIL(ls.diagnose(diagnose_info))) {
SERVER_LOG(WARN, "ls stat diagnose info failed", K(ret), K(ls));
if (OB_ENTRY_NOT_EXIST == ret) {
SERVER_LOG(WARN, "ls may have been removed, just skip", K(ls));
ret = OB_SUCCESS;
} else {
SERVER_LOG(WARN, "ls stat diagnose info failed", K(ret), K(ls));
}
} else if (OB_FAIL(insert_stat_(diagnose_info))) {
SERVER_LOG(WARN, "insert stat failed", K(ret), K(diagnose_info));
} else if (OB_FAIL(scanner_.add_row(cur_row_))) {