[PALF] fix GET_MIN_DATA_VERSION may return -4018

This commit is contained in:
BinChenn
2023-04-26 15:09:35 +00:00
committed by ob-robot
parent 3514f929b6
commit ef51ca80f8
9 changed files with 39 additions and 61 deletions

View File

@ -1287,6 +1287,21 @@ TEST_F(TestLogConfigMgr, test_handle_retire_msg)
PALF_LOG(INFO, "test_handle_retire_msg end case");
}
TEST_F(TestLogConfigMgr, test_init_by_default_config_meta)
{
const int64_t init_log_proposal_id = 0;
LogConfigInfo init_config_info;
LogConfigVersion init_config_version;
init_config_version.generate(init_log_proposal_id, 0);
init_config_info.config_version_ = init_config_version;
LogConfigMeta log_config_meta;
LogConfigMgr cm;
EXPECT_EQ(OB_SUCCESS, log_config_meta.generate_for_default(init_log_proposal_id,
init_config_info, init_config_info));
EXPECT_EQ(OB_SUCCESS, cm.init(1, addr1, log_config_meta, mock_log_engine_,
mock_sw_, mock_state_mgr_, mock_election_,
mock_mode_mgr_, mock_reconfirm_, mock_plugins_));
}
} // end namespace unittest
} // end namespace oceanbase

View File

@ -21,6 +21,8 @@ namespace oceanbase
{
using namespace common;
using namespace palf;
constexpr int64_t palf::LogConfigMeta::LOG_CONFIG_META_VERSION;
constexpr int64_t palf::LogConfigMeta::LOG_CONFIG_META_VERSION_INC;
namespace unittest
{
@ -120,6 +122,12 @@ TEST(TestLogMetaInfos, test_log_config_meta)
const LSN barrier_lsn = LSN(300);
const int64_t barrier_mode_pid = 4;
// Test default version
LogConfigMeta default_config_meta;
EXPECT_EQ(OB_SUCCESS, default_config_meta.generate_for_default(curr_log_proposal_id, prev_config_info, curr_config_info));
EXPECT_TRUE(default_config_meta.is_valid());
EXPECT_EQ(palf::LogConfigMeta::LOG_CONFIG_META_VERSION_INC, default_config_meta.version_);
// Test invalid argument
LogConfigMeta log_config_meta;
EXPECT_EQ(OB_INVALID_ARGUMENT, log_config_meta.generate(curr_log_proposal_id, prev_config_info, curr_config_info,