@@ -1101,10 +1101,8 @@ void Tablet::pick_candidate_rowsets_to_cumulative_compaction(
11011101
11021102void Tablet::pick_candidate_rowsets_to_base_compaction (vector<RowsetSharedPtr>* candidate_rowsets) {
11031103 std::shared_lock rdlock (_meta_lock);
1104- // FIXME(cyx): If there are delete predicate rowsets in tablet,
1105- // remote rowsets cannot apply these delete predicate, which can cause
1106- // incorrect query result.
11071104 for (auto & it : _rs_version_map) {
1105+ // Do compaction on local rowsets only.
11081106 if (it.first .first < _cumulative_point && it.second ->is_local ()) {
11091107 candidate_rowsets->push_back (it.second );
11101108 }
@@ -1659,7 +1657,7 @@ Status Tablet::cooldown() {
16591657 LOG (WARNING ) << " Failed to own cumu_compaction_lock. tablet=" << tablet_id ();
16601658 return Status::OLAPInternalError (OLAP_ERR_BE_TRY_BE_LOCK_ERROR );
16611659 }
1662- auto dest_fs = io::FileSystemMap::instance ()->get (cooldown_resource ());
1660+ auto dest_fs = io::FileSystemMap::instance ()->get (storage_policy ());
16631661 if (!dest_fs) {
16641662 return Status::OLAPInternalError (OLAP_ERR_NOT_INITED );
16651663 }
@@ -1694,7 +1692,7 @@ Status Tablet::cooldown() {
16941692 new_rowset_meta->set_fs (dest_fs);
16951693 new_rowset_meta->set_creation_time (time (nullptr ));
16961694 RowsetSharedPtr new_rowset;
1697- RowsetFactory::create_rowset (&_schema, _tablet_path, std::move ( new_rowset_meta) , &new_rowset);
1695+ RowsetFactory::create_rowset (&_schema, _tablet_path, new_rowset_meta, &new_rowset);
16981696
16991697 std::vector to_add {std::move (new_rowset)};
17001698 std::vector to_delete {std::move (old_rowset)};
@@ -1705,6 +1703,10 @@ Status Tablet::cooldown() {
17051703 has_shutdown = tablet_state () == TABLET_SHUTDOWN ;
17061704 if (!has_shutdown) {
17071705 modify_rowsets (to_add, to_delete);
1706+ if (new_rowset_meta->has_delete_predicate ()) {
1707+ add_delete_predicate (new_rowset_meta->delete_predicate (),
1708+ new_rowset_meta->start_version ());
1709+ }
17081710 _self_owned_remote_rowsets.insert (to_add.front ());
17091711 save_meta ();
17101712 }
@@ -1737,13 +1739,13 @@ RowsetSharedPtr Tablet::pick_cooldown_rowset() {
17371739
17381740bool Tablet::need_cooldown (int64_t * cooldown_timestamp, size_t * file_size) {
17391741 // std::shared_lock meta_rlock(_meta_lock);
1740- if (cooldown_resource ().empty ()) {
1742+ if (storage_policy ().empty ()) {
17411743 VLOG_DEBUG << " tablet does not need cooldown, tablet id: " << tablet_id ();
17421744 return false ;
17431745 }
1744- auto policy = ExecEnv::GetInstance ()->storage_policy_mgr ()->get (cooldown_resource ());
1746+ auto policy = ExecEnv::GetInstance ()->storage_policy_mgr ()->get (storage_policy ());
17451747 if (!policy) {
1746- LOG (WARNING ) << " Cannot get storage policy: " << cooldown_resource ();
1748+ LOG (WARNING ) << " Cannot get storage policy: " << storage_policy ();
17471749 return false ;
17481750 }
17491751 auto cooldown_ttl_sec = policy->cooldown_ttl ;
0 commit comments