From dc8f8f21066852d8df59a695593115ec20b48076 Mon Sep 17 00:00:00 2001 From: oceanoverflow Date: Sun, 28 Apr 2024 12:38:11 +0000 Subject: [PATCH] Revert Fix tablet table store check sstable continue bug. --- .../high_availability/ob_transfer_struct.cpp | 4 +- src/storage/tablet/ob_tablet_table_store.cpp | 37 ++++++------------- src/storage/tablet/ob_tablet_table_store.h | 3 +- unittest/storage/test_compaction_policy.cpp | 36 ------------------ 4 files changed, 15 insertions(+), 65 deletions(-) diff --git a/src/storage/high_availability/ob_transfer_struct.cpp b/src/storage/high_availability/ob_transfer_struct.cpp index 0a45e3b9f6..147e7bdfd6 100644 --- a/src/storage/high_availability/ob_transfer_struct.cpp +++ b/src/storage/high_availability/ob_transfer_struct.cpp @@ -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_ = end_scn; + param.filled_tx_scn_.set_min(); param.original_size_ = 0; param.compressor_type_ = ObCompressorType::NONE_COMPRESSOR; @@ -1006,4 +1006,4 @@ int ObTransferRelatedInfo::get_related_info_task_id(share::ObTransferTaskID &tas task_id = get_task_id_(); } return ret; -} +} \ No newline at end of file diff --git a/src/storage/tablet/ob_tablet_table_store.cpp b/src/storage/tablet/ob_tablet_table_store.cpp index dd807aebc9..9489d08b9c 100644 --- a/src/storage/tablet/ob_tablet_table_store.cpp +++ b/src/storage/tablet/ob_tablet_table_store.cpp @@ -1902,10 +1902,9 @@ int ObTabletTableStore::check_minor_tables_continue_(T &minor_tables) const int ret = OB_SUCCESS; ObITable *prev_table = nullptr; prev_table = nullptr; - SCN filled_tx_scn(SCN::min_scn()); for (int64_t i = 0; OB_SUCC(ret) && i < minor_tables.count(); ++i) { ObITable *table = minor_tables.at(i); - if (OB_FAIL(check_minor_table_continue_(table, prev_table, filled_tx_scn))) { + if (OB_FAIL(check_minor_table_continue_(table, prev_table))) { LOG_WARN("failed to check minor table continue", K(ret), KPC(table)); } } @@ -2275,41 +2274,30 @@ int ObTabletTableStore::cut_ha_sstable_scn_range_( int ObTabletTableStore::check_minor_table_continue_( ObITable *table, - ObITable *&prev_table, - share::SCN &filled_tx_scn) 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 (FALSE_IT(curr_sstable = static_cast(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 (table->get_key().tablet_id_.is_ls_inner_tablet()) { - //do nothing - } else if (curr_sstable->is_empty() || curr_sstable->get_filled_tx_scn().is_max()) { - //skip empty sstable pr max filled tx scn for compatible - LOG_INFO("current sstable is empty or filled tx scn is max, skip check this tablet filled tx scn", KPC(curr_sstable)); - } else if (curr_sstable->get_filled_tx_scn() < filled_tx_scn) { + } else if (FALSE_IT(curr_sstable = static_cast(table))) { + } else if (FALSE_IT(prev_sstable = static_cast(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", filled_tx_scn); - } - - if (OB_SUCC(ret)) { - prev_table = table; - if (!curr_sstable->get_key().tablet_id_.is_ls_inner_tablet() - && !curr_sstable->is_empty() - && !curr_sstable->get_filled_tx_scn().is_max()) { - filled_tx_scn = curr_sstable->get_filled_tx_scn(); - } + "curr_filled_tx_scn", curr_sstable->get_filled_tx_scn(), "prev_filled_tx_scn", prev_sstable->get_filled_tx_scn()); } + prev_table = table; return ret; } @@ -2320,7 +2308,6 @@ int ObTabletTableStore::check_minor_tables_continue_( int ret = OB_SUCCESS; ObITable *prev_table = nullptr; prev_table = nullptr; - SCN filled_tx_scn(SCN::min_scn()); if (count > 0 && OB_ISNULL(minor_sstables)) { ret = OB_ERR_UNEXPECTED; LOG_WARN("check minor tables continue minor sstables is unexpected", K(ret), KP(minor_sstables), K(count)); @@ -2328,7 +2315,7 @@ int ObTabletTableStore::check_minor_tables_continue_( for (int64_t i = 0; OB_SUCC(ret) && i < count; ++i) { ObITable *table = minor_sstables[i]; - if (OB_FAIL(check_minor_table_continue_(table, prev_table, filled_tx_scn))) { + if (OB_FAIL(check_minor_table_continue_(table, prev_table))) { LOG_WARN("failed to check minor table continue", K(ret), KPC(table)); } } diff --git a/src/storage/tablet/ob_tablet_table_store.h b/src/storage/tablet/ob_tablet_table_store.h index 7ba7327b10..d00cfb8d02 100644 --- a/src/storage/tablet/ob_tablet_table_store.h +++ b/src/storage/tablet/ob_tablet_table_store.h @@ -308,8 +308,7 @@ private: ObITable **minor_sstables) const; int check_minor_table_continue_( ObITable *table, - ObITable *&prev_table, - share::SCN &filled_tx_scn) const; + ObITable *prev_table) const; int combine_ha_minor_sstables_( const ObTablet &tablet, common::ObIArray &old_store_minor_sstables, diff --git a/unittest/storage/test_compaction_policy.cpp b/unittest/storage/test_compaction_policy.cpp index 13215772fc..cf9553cd59 100644 --- a/unittest/storage/test_compaction_policy.cpp +++ b/unittest/storage/test_compaction_policy.cpp @@ -1096,42 +1096,6 @@ 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 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 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