yiguolei commented on code in PR #66151: URL: https://github.com/apache/doris/pull/66151#discussion_r3717891738
########## be/src/storage/mow/key_probe.cpp: ########## @@ -0,0 +1,168 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#include "storage/mow/key_probe.h" + +#include "common/cast_set.h" +#include "common/config.h" +#include "common/logging.h" +#include "service/point_query_executor.h" +#include "storage/key/row_key_encoder.h" +#include "storage/partial_update_info.h" +#include "storage/tablet/base_tablet.h" +#include "storage/tablet/tablet_meta.h" +#include "storage/tablet/tablet_schema.h" + +namespace doris::segment_v2 { + +using namespace ErrorCode; + +MowKeyProbe::MowKeyProbe(BaseTablet* tablet, TabletSchema* lookup_schema, bool has_sequence_col, + std::shared_ptr<MowContext> mow_context, const RowsetId& writing_rowset_id, + uint32_t writing_segment_id, Policy policy) + : _tablet(tablet), + _lookup_schema(lookup_schema), + _has_sequence_col(has_sequence_col), + _mow_context(std::move(mow_context)), + _writing_rowset_id(writing_rowset_id), + _writing_segment_id(writing_segment_id), + _policy(policy) {} + +Result<ProbeOutcome> MowKeyProbe::probe( + const std::string& key, size_t segment_pos, bool key_has_seq_suffix, bool have_delete_sign, + const std::vector<RowsetSharedPtr>& specified_rowsets, + std::vector<std::unique_ptr<SegmentCacheHandle>>& segment_caches, + PartialUpdateStats& stats) const { + RowLocation loc; + // save rowset shared ptr so this rowset wouldn't delete + RowsetSharedPtr rowset; + auto st = _tablet->lookup_row_key(key, _lookup_schema, key_has_seq_suffix, specified_rowsets, + &loc, _mow_context->max_version, segment_caches, &rowset, + /*with_rowid=*/false); + if (st.is<KEY_NOT_FOUND>()) { + ++stats.num_rows_new_added; Review Comment: 这个stats 感觉不应该在这维护。 外部只是调用一个probe,也没说一定会add new rows啊 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
