Fix check sstable version range continues bug.
This commit is contained in:
parent
c8f1109957
commit
406d31f5f2
@ -477,7 +477,7 @@ int ObTXTransferUtils::build_empty_minor_sstable_param_(
|
||||
param.data_checksum_ = 0;
|
||||
param.occupy_size_ = 0;
|
||||
param.ddl_scn_.set_min();
|
||||
param.filled_tx_scn_.set_min();
|
||||
param.filled_tx_scn_ = end_scn;
|
||||
param.original_size_ = 0;
|
||||
param.compressor_type_ = ObCompressorType::NONE_COMPRESSOR;
|
||||
|
||||
|
@ -2274,30 +2274,25 @@ int ObTabletTableStore::cut_ha_sstable_scn_range_(
|
||||
|
||||
int ObTabletTableStore::check_minor_table_continue_(
|
||||
ObITable *table,
|
||||
ObITable *prev_table) const
|
||||
ObITable *&prev_table) const
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObSSTable *curr_sstable = nullptr;
|
||||
ObSSTable *prev_sstable = nullptr;
|
||||
|
||||
if (OB_UNLIKELY(OB_ISNULL(table) || !table->is_multi_version_minor_sstable())) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("table must be multi version minor table", K(ret), KPC(table));
|
||||
} else if (OB_ISNULL(prev_table)) {
|
||||
// do nothing
|
||||
//do nothing
|
||||
} else if (table->get_start_scn() > prev_table->get_end_scn()
|
||||
|| table->get_end_scn() <= prev_table->get_end_scn()) {
|
||||
ret = OB_ERR_SYS;
|
||||
LOG_ERROR("table scn range not continuous or overlap", K(ret), KPC(table), KPC(prev_table));
|
||||
} else if (FALSE_IT(curr_sstable = static_cast<ObSSTable *>(table))) {
|
||||
} else if (FALSE_IT(prev_sstable = static_cast<ObSSTable *>(prev_table))) {
|
||||
} else if (table->get_key().tablet_id_.is_ls_inner_tablet() || prev_sstable->get_filled_tx_scn().is_max()) {
|
||||
// do nothing
|
||||
} else if (curr_sstable->get_filled_tx_scn() < prev_sstable->get_filled_tx_scn()) {
|
||||
ret = OB_ERR_SYS;
|
||||
LOG_WARN("sstable's filled_tx_scn is out of order", K(ret), KPC(table), KP(prev_table),
|
||||
"curr_filled_tx_scn", curr_sstable->get_filled_tx_scn(), "prev_filled_tx_scn", prev_sstable->get_filled_tx_scn());
|
||||
}
|
||||
prev_table = table;
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
prev_table = table;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -308,7 +308,7 @@ private:
|
||||
ObITable **minor_sstables) const;
|
||||
int check_minor_table_continue_(
|
||||
ObITable *table,
|
||||
ObITable *prev_table) const;
|
||||
ObITable *&prev_table) const;
|
||||
int combine_ha_minor_sstables_(
|
||||
const ObTablet &tablet,
|
||||
common::ObIArray<ObITable *> &old_store_minor_sstables,
|
||||
|
@ -1096,6 +1096,43 @@ TEST_F(TestCompactionPolicy, test_minor_dag_intersect)
|
||||
ASSERT_EQ(false, (dag1 == dag2));
|
||||
}
|
||||
|
||||
|
||||
TEST_F(TestCompactionPolicy, check_sstable_continue_failed)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObTenantFreezeInfoMgr *mgr = MTL(ObTenantFreezeInfoMgr *);
|
||||
ASSERT_TRUE(nullptr != mgr);
|
||||
|
||||
common::ObArray<share::ObFreezeInfo> freeze_info;
|
||||
share::SCN frozen_val;
|
||||
frozen_val.val_ = 1;
|
||||
ASSERT_EQ(OB_SUCCESS, freeze_info.push_back(share::ObFreezeInfo(frozen_val, 1, 0)));
|
||||
|
||||
ret = TestCompactionPolicy::prepare_freeze_info(500, freeze_info);
|
||||
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
|
||||
const char *key_data =
|
||||
"table_type start_scn end_scn max_ver upper_ver\n"
|
||||
"10 0 1 1 1 \n"
|
||||
"11 1 150 150 150 \n"
|
||||
"11 150 200 200 200 \n"
|
||||
"11 200 250 250 250 \n"
|
||||
"11 250 300 300 300 \n"
|
||||
"11 900 1000 1000 1000 \n";
|
||||
|
||||
ret = prepare_tablet(key_data, 1000, 1000);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
|
||||
ObTablet *tablet = tablet_handle_.get_obj();
|
||||
ASSERT_TRUE(nullptr != tablet);
|
||||
ObTabletMemberWrapper<ObTabletTableStore> table_store_wrapper;
|
||||
ret = tablet->fetch_table_store(table_store_wrapper);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ret = table_store_wrapper.get_member()->check_continuous();
|
||||
ASSERT_EQ(OB_ERR_SYS, ret);
|
||||
}
|
||||
|
||||
} //unittest
|
||||
} //oceanbase
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user