github-actions[bot] commented on code in PR #30089: URL: https://github.com/apache/doris/pull/30089#discussion_r1456781051
########## be/src/cloud/cloud_tablet_mgr.h: ########## @@ -0,0 +1,68 @@ +// 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. + +#pragma once + +namespace doris { + +class CloudTablet; +class CloudStorageEngine; +class LRUCachePolicy; + +class CloudTabletMgr { +public: + CloudTabletMgr(CloudStorageEngine& engine); + ~CloudTabletMgr(); + + // If the tablet is in cache, return this tablet directly; otherwise will get tablet meta first, + // sync rowsets after, and download segment data in background if `warmup_data` is true. + Result<std::shared_ptr<CloudTablet>> get_tablet(int64_t tablet_id, bool warmup_data = false); + + void erase_tablet(int64_t tablet_id); Review Comment: warning: unknown type name 'int64_t' [clang-diagnostic-error] ```cpp void erase_tablet(int64_t tablet_id); ^ ``` ########## be/src/cloud/cloud_tablet_mgr.h: ########## @@ -0,0 +1,68 @@ +// 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. + +#pragma once + +namespace doris { + +class CloudTablet; +class CloudStorageEngine; +class LRUCachePolicy; + +class CloudTabletMgr { +public: + CloudTabletMgr(CloudStorageEngine& engine); + ~CloudTabletMgr(); + + // If the tablet is in cache, return this tablet directly; otherwise will get tablet meta first, + // sync rowsets after, and download segment data in background if `warmup_data` is true. + Result<std::shared_ptr<CloudTablet>> get_tablet(int64_t tablet_id, bool warmup_data = false); + + void erase_tablet(int64_t tablet_id); + + void vacuum_stale_rowsets(); + + // Return weak ptr of all cached tablets. + // We return weak ptr to avoid extend lifetime of tablets that are no longer cached. + std::vector<std::weak_ptr<CloudTablet>> get_weak_tablets(); + + void sync_tablets(); + + /** + * Gets top N tablets that are considered to be compacted first + * + * @param n max number of tablets to get, all of them are comapction enabled + * @param filter_out a filter takes a tablet and return bool to check + * whether skipping the tablet, true for skip + * @param tablets output param + * @param max_score output param, max score of existed tablets + * @return status of this call + */ + Status get_topn_tablets_to_compact(int n, CompactionType compaction_type, + const std::function<bool(CloudTablet*)>& filter_out, + std::vector<std::shared_ptr<CloudTablet>>* tablets, Review Comment: warning: expected ')' [clang-diagnostic-error] ```cpp std::vector<std::shared_ptr<CloudTablet>>* tablets, ^ ``` <details> <summary>Additional context</summary> **be/src/cloud/cloud_tablet_mgr.h:54:** to match this '(' ```cpp Status get_topn_tablets_to_compact(int n, CompactionType compaction_type, ^ ``` </details> ########## be/src/cloud/cloud_tablet_mgr.h: ########## @@ -0,0 +1,68 @@ +// 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. + +#pragma once + +namespace doris { + +class CloudTablet; +class CloudStorageEngine; +class LRUCachePolicy; + +class CloudTabletMgr { +public: + CloudTabletMgr(CloudStorageEngine& engine); + ~CloudTabletMgr(); + + // If the tablet is in cache, return this tablet directly; otherwise will get tablet meta first, + // sync rowsets after, and download segment data in background if `warmup_data` is true. + Result<std::shared_ptr<CloudTablet>> get_tablet(int64_t tablet_id, bool warmup_data = false); Review Comment: warning: 'CloudTablet' does not refer to a value [clang-diagnostic-error] ```cpp Result<std::shared_ptr<CloudTablet>> get_tablet(int64_t tablet_id, bool warmup_data = false); ^ ``` <details> <summary>Additional context</summary> **be/src/cloud/cloud_tablet_mgr.h:21:** declared here ```cpp class CloudTablet; ^ ``` </details> ########## be/src/cloud/cloud_tablet_mgr.h: ########## @@ -0,0 +1,68 @@ +// 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. + +#pragma once + +namespace doris { + +class CloudTablet; +class CloudStorageEngine; +class LRUCachePolicy; + +class CloudTabletMgr { +public: + CloudTabletMgr(CloudStorageEngine& engine); + ~CloudTabletMgr(); + + // If the tablet is in cache, return this tablet directly; otherwise will get tablet meta first, + // sync rowsets after, and download segment data in background if `warmup_data` is true. + Result<std::shared_ptr<CloudTablet>> get_tablet(int64_t tablet_id, bool warmup_data = false); Review Comment: warning: use of undeclared identifier 'std' [clang-diagnostic-error] ```cpp Result<std::shared_ptr<CloudTablet>> get_tablet(int64_t tablet_id, bool warmup_data = false); ^ ``` ########## be/src/cloud/cloud_tablet_mgr.cpp: ########## @@ -0,0 +1,356 @@ +// 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 "cloud/cloud_tablet_mgr.h" + +#include <bthread/countdown_event.h> Review Comment: warning: 'bthread/countdown_event.h' file not found [clang-diagnostic-error] ```cpp #include <bthread/countdown_event.h> ^ ``` ########## be/src/cloud/cloud_tablet_mgr.h: ########## @@ -0,0 +1,68 @@ +// 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. + +#pragma once + +namespace doris { + +class CloudTablet; +class CloudStorageEngine; +class LRUCachePolicy; + +class CloudTabletMgr { +public: + CloudTabletMgr(CloudStorageEngine& engine); + ~CloudTabletMgr(); + + // If the tablet is in cache, return this tablet directly; otherwise will get tablet meta first, + // sync rowsets after, and download segment data in background if `warmup_data` is true. + Result<std::shared_ptr<CloudTablet>> get_tablet(int64_t tablet_id, bool warmup_data = false); + + void erase_tablet(int64_t tablet_id); + + void vacuum_stale_rowsets(); + + // Return weak ptr of all cached tablets. + // We return weak ptr to avoid extend lifetime of tablets that are no longer cached. + std::vector<std::weak_ptr<CloudTablet>> get_weak_tablets(); Review Comment: warning: use of undeclared identifier 'std' [clang-diagnostic-error] ```cpp std::vector<std::weak_ptr<CloudTablet>> get_weak_tablets(); ^ ``` ########## be/src/cloud/cloud_tablet_mgr.h: ########## @@ -0,0 +1,68 @@ +// 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. + +#pragma once + +namespace doris { + +class CloudTablet; +class CloudStorageEngine; +class LRUCachePolicy; + +class CloudTabletMgr { +public: + CloudTabletMgr(CloudStorageEngine& engine); + ~CloudTabletMgr(); + + // If the tablet is in cache, return this tablet directly; otherwise will get tablet meta first, + // sync rowsets after, and download segment data in background if `warmup_data` is true. + Result<std::shared_ptr<CloudTablet>> get_tablet(int64_t tablet_id, bool warmup_data = false); Review Comment: warning: expected member name or ';' after declaration specifiers [clang-diagnostic-error] ```cpp Result<std::shared_ptr<CloudTablet>> get_tablet(int64_t tablet_id, bool warmup_data = false); ^ ``` ########## be/src/cloud/cloud_tablet_mgr.h: ########## @@ -0,0 +1,68 @@ +// 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. + +#pragma once + +namespace doris { + +class CloudTablet; +class CloudStorageEngine; +class LRUCachePolicy; + +class CloudTabletMgr { +public: + CloudTabletMgr(CloudStorageEngine& engine); + ~CloudTabletMgr(); + + // If the tablet is in cache, return this tablet directly; otherwise will get tablet meta first, + // sync rowsets after, and download segment data in background if `warmup_data` is true. + Result<std::shared_ptr<CloudTablet>> get_tablet(int64_t tablet_id, bool warmup_data = false); + + void erase_tablet(int64_t tablet_id); + + void vacuum_stale_rowsets(); + + // Return weak ptr of all cached tablets. + // We return weak ptr to avoid extend lifetime of tablets that are no longer cached. + std::vector<std::weak_ptr<CloudTablet>> get_weak_tablets(); Review Comment: warning: 'CloudTablet' does not refer to a value [clang-diagnostic-error] ```cpp std::vector<std::weak_ptr<CloudTablet>> get_weak_tablets(); ^ ``` <details> <summary>Additional context</summary> **be/src/cloud/cloud_tablet_mgr.h:21:** declared here ```cpp class CloudTablet; ^ ``` </details> ########## be/src/cloud/cloud_tablet_mgr.h: ########## @@ -0,0 +1,68 @@ +// 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. + +#pragma once + +namespace doris { + +class CloudTablet; +class CloudStorageEngine; +class LRUCachePolicy; + +class CloudTabletMgr { +public: + CloudTabletMgr(CloudStorageEngine& engine); + ~CloudTabletMgr(); + + // If the tablet is in cache, return this tablet directly; otherwise will get tablet meta first, + // sync rowsets after, and download segment data in background if `warmup_data` is true. + Result<std::shared_ptr<CloudTablet>> get_tablet(int64_t tablet_id, bool warmup_data = false); + + void erase_tablet(int64_t tablet_id); + + void vacuum_stale_rowsets(); + + // Return weak ptr of all cached tablets. + // We return weak ptr to avoid extend lifetime of tablets that are no longer cached. + std::vector<std::weak_ptr<CloudTablet>> get_weak_tablets(); Review Comment: warning: expected member name or ';' after declaration specifiers [clang-diagnostic-error] ```cpp std::vector<std::weak_ptr<CloudTablet>> get_weak_tablets(); ^ ``` ########## be/src/cloud/cloud_tablet_mgr.h: ########## @@ -0,0 +1,68 @@ +// 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. + +#pragma once + +namespace doris { + +class CloudTablet; +class CloudStorageEngine; +class LRUCachePolicy; + +class CloudTabletMgr { +public: + CloudTabletMgr(CloudStorageEngine& engine); + ~CloudTabletMgr(); + + // If the tablet is in cache, return this tablet directly; otherwise will get tablet meta first, + // sync rowsets after, and download segment data in background if `warmup_data` is true. + Result<std::shared_ptr<CloudTablet>> get_tablet(int64_t tablet_id, bool warmup_data = false); + + void erase_tablet(int64_t tablet_id); + + void vacuum_stale_rowsets(); + + // Return weak ptr of all cached tablets. + // We return weak ptr to avoid extend lifetime of tablets that are no longer cached. + std::vector<std::weak_ptr<CloudTablet>> get_weak_tablets(); Review Comment: warning: use of undeclared identifier 'std' [clang-diagnostic-error] ```cpp std::vector<std::weak_ptr<CloudTablet>> get_weak_tablets(); ^ ``` ########## be/src/cloud/cloud_tablet_mgr.h: ########## @@ -0,0 +1,68 @@ +// 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. + +#pragma once + +namespace doris { + +class CloudTablet; +class CloudStorageEngine; +class LRUCachePolicy; + +class CloudTabletMgr { +public: + CloudTabletMgr(CloudStorageEngine& engine); + ~CloudTabletMgr(); + + // If the tablet is in cache, return this tablet directly; otherwise will get tablet meta first, + // sync rowsets after, and download segment data in background if `warmup_data` is true. + Result<std::shared_ptr<CloudTablet>> get_tablet(int64_t tablet_id, bool warmup_data = false); + + void erase_tablet(int64_t tablet_id); + + void vacuum_stale_rowsets(); + + // Return weak ptr of all cached tablets. + // We return weak ptr to avoid extend lifetime of tablets that are no longer cached. + std::vector<std::weak_ptr<CloudTablet>> get_weak_tablets(); + + void sync_tablets(); + + /** + * Gets top N tablets that are considered to be compacted first + * + * @param n max number of tablets to get, all of them are comapction enabled + * @param filter_out a filter takes a tablet and return bool to check + * whether skipping the tablet, true for skip + * @param tablets output param + * @param max_score output param, max score of existed tablets + * @return status of this call + */ + Status get_topn_tablets_to_compact(int n, CompactionType compaction_type, Review Comment: warning: unknown type name 'Status' [clang-diagnostic-error] ```cpp Status get_topn_tablets_to_compact(int n, CompactionType compaction_type, ^ ``` ########## be/src/cloud/cloud_tablet_mgr.h: ########## @@ -0,0 +1,68 @@ +// 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. + +#pragma once + +namespace doris { + +class CloudTablet; +class CloudStorageEngine; +class LRUCachePolicy; + +class CloudTabletMgr { +public: + CloudTabletMgr(CloudStorageEngine& engine); + ~CloudTabletMgr(); + + // If the tablet is in cache, return this tablet directly; otherwise will get tablet meta first, + // sync rowsets after, and download segment data in background if `warmup_data` is true. + Result<std::shared_ptr<CloudTablet>> get_tablet(int64_t tablet_id, bool warmup_data = false); + + void erase_tablet(int64_t tablet_id); + + void vacuum_stale_rowsets(); + + // Return weak ptr of all cached tablets. + // We return weak ptr to avoid extend lifetime of tablets that are no longer cached. + std::vector<std::weak_ptr<CloudTablet>> get_weak_tablets(); + + void sync_tablets(); + + /** + * Gets top N tablets that are considered to be compacted first + * + * @param n max number of tablets to get, all of them are comapction enabled + * @param filter_out a filter takes a tablet and return bool to check + * whether skipping the tablet, true for skip + * @param tablets output param + * @param max_score output param, max score of existed tablets + * @return status of this call + */ + Status get_topn_tablets_to_compact(int n, CompactionType compaction_type, + const std::function<bool(CloudTablet*)>& filter_out, Review Comment: warning: use of undeclared identifier 'std' [clang-diagnostic-error] ```cpp const std::function<bool(CloudTablet*)>& filter_out, ^ ``` ########## be/src/cloud/cloud_tablet_mgr.h: ########## @@ -0,0 +1,68 @@ +// 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. + +#pragma once + +namespace doris { + +class CloudTablet; +class CloudStorageEngine; +class LRUCachePolicy; + +class CloudTabletMgr { +public: + CloudTabletMgr(CloudStorageEngine& engine); + ~CloudTabletMgr(); + + // If the tablet is in cache, return this tablet directly; otherwise will get tablet meta first, + // sync rowsets after, and download segment data in background if `warmup_data` is true. + Result<std::shared_ptr<CloudTablet>> get_tablet(int64_t tablet_id, bool warmup_data = false); + + void erase_tablet(int64_t tablet_id); + + void vacuum_stale_rowsets(); + + // Return weak ptr of all cached tablets. + // We return weak ptr to avoid extend lifetime of tablets that are no longer cached. + std::vector<std::weak_ptr<CloudTablet>> get_weak_tablets(); + + void sync_tablets(); + + /** + * Gets top N tablets that are considered to be compacted first + * + * @param n max number of tablets to get, all of them are comapction enabled + * @param filter_out a filter takes a tablet and return bool to check + * whether skipping the tablet, true for skip + * @param tablets output param + * @param max_score output param, max score of existed tablets + * @return status of this call + */ + Status get_topn_tablets_to_compact(int n, CompactionType compaction_type, + const std::function<bool(CloudTablet*)>& filter_out, + std::vector<std::shared_ptr<CloudTablet>>* tablets, Review Comment: warning: use of undeclared identifier 'std' [clang-diagnostic-error] ```cpp std::vector<std::shared_ptr<CloudTablet>>* tablets, ^ ``` ########## be/src/cloud/cloud_tablet_mgr.h: ########## @@ -0,0 +1,68 @@ +// 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. + +#pragma once + +namespace doris { + +class CloudTablet; +class CloudStorageEngine; +class LRUCachePolicy; + +class CloudTabletMgr { +public: + CloudTabletMgr(CloudStorageEngine& engine); + ~CloudTabletMgr(); + + // If the tablet is in cache, return this tablet directly; otherwise will get tablet meta first, + // sync rowsets after, and download segment data in background if `warmup_data` is true. + Result<std::shared_ptr<CloudTablet>> get_tablet(int64_t tablet_id, bool warmup_data = false); + + void erase_tablet(int64_t tablet_id); + + void vacuum_stale_rowsets(); + + // Return weak ptr of all cached tablets. + // We return weak ptr to avoid extend lifetime of tablets that are no longer cached. + std::vector<std::weak_ptr<CloudTablet>> get_weak_tablets(); + + void sync_tablets(); + + /** + * Gets top N tablets that are considered to be compacted first + * + * @param n max number of tablets to get, all of them are comapction enabled + * @param filter_out a filter takes a tablet and return bool to check + * whether skipping the tablet, true for skip + * @param tablets output param + * @param max_score output param, max score of existed tablets + * @return status of this call + */ + Status get_topn_tablets_to_compact(int n, CompactionType compaction_type, + const std::function<bool(CloudTablet*)>& filter_out, + std::vector<std::shared_ptr<CloudTablet>>* tablets, + int64_t* max_score); + +private: + CloudStorageEngine& _engine; + + class TabletMap; + std::unique_ptr<TabletMap> _tablet_map; Review Comment: warning: use of undeclared identifier 'std' [clang-diagnostic-error] ```cpp std::unique_ptr<TabletMap> _tablet_map; ^ ``` ########## be/src/cloud/cloud_tablet_mgr.h: ########## @@ -0,0 +1,68 @@ +// 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. + +#pragma once + +namespace doris { + +class CloudTablet; +class CloudStorageEngine; +class LRUCachePolicy; + +class CloudTabletMgr { +public: + CloudTabletMgr(CloudStorageEngine& engine); + ~CloudTabletMgr(); + + // If the tablet is in cache, return this tablet directly; otherwise will get tablet meta first, + // sync rowsets after, and download segment data in background if `warmup_data` is true. + Result<std::shared_ptr<CloudTablet>> get_tablet(int64_t tablet_id, bool warmup_data = false); + + void erase_tablet(int64_t tablet_id); + + void vacuum_stale_rowsets(); + + // Return weak ptr of all cached tablets. + // We return weak ptr to avoid extend lifetime of tablets that are no longer cached. + std::vector<std::weak_ptr<CloudTablet>> get_weak_tablets(); + + void sync_tablets(); + + /** + * Gets top N tablets that are considered to be compacted first + * + * @param n max number of tablets to get, all of them are comapction enabled + * @param filter_out a filter takes a tablet and return bool to check + * whether skipping the tablet, true for skip + * @param tablets output param + * @param max_score output param, max score of existed tablets + * @return status of this call + */ + Status get_topn_tablets_to_compact(int n, CompactionType compaction_type, Review Comment: warning: unknown type name 'CompactionType' [clang-diagnostic-error] ```cpp Status get_topn_tablets_to_compact(int n, CompactionType compaction_type, ^ ``` ########## be/src/cloud/cloud_tablet_mgr.h: ########## @@ -0,0 +1,68 @@ +// 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. + +#pragma once + +namespace doris { + +class CloudTablet; +class CloudStorageEngine; +class LRUCachePolicy; + +class CloudTabletMgr { +public: + CloudTabletMgr(CloudStorageEngine& engine); + ~CloudTabletMgr(); + + // If the tablet is in cache, return this tablet directly; otherwise will get tablet meta first, + // sync rowsets after, and download segment data in background if `warmup_data` is true. + Result<std::shared_ptr<CloudTablet>> get_tablet(int64_t tablet_id, bool warmup_data = false); + + void erase_tablet(int64_t tablet_id); + + void vacuum_stale_rowsets(); + + // Return weak ptr of all cached tablets. + // We return weak ptr to avoid extend lifetime of tablets that are no longer cached. + std::vector<std::weak_ptr<CloudTablet>> get_weak_tablets(); + + void sync_tablets(); + + /** + * Gets top N tablets that are considered to be compacted first + * + * @param n max number of tablets to get, all of them are comapction enabled + * @param filter_out a filter takes a tablet and return bool to check + * whether skipping the tablet, true for skip + * @param tablets output param + * @param max_score output param, max score of existed tablets + * @return status of this call + */ + Status get_topn_tablets_to_compact(int n, CompactionType compaction_type, + const std::function<bool(CloudTablet*)>& filter_out, + std::vector<std::shared_ptr<CloudTablet>>* tablets, Review Comment: warning: use of undeclared identifier 'std' [clang-diagnostic-error] ```cpp std::vector<std::shared_ptr<CloudTablet>>* tablets, ^ ``` ########## be/src/cloud/cloud_tablet_mgr.h: ########## @@ -0,0 +1,68 @@ +// 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. + +#pragma once + +namespace doris { + +class CloudTablet; +class CloudStorageEngine; +class LRUCachePolicy; + +class CloudTabletMgr { +public: + CloudTabletMgr(CloudStorageEngine& engine); + ~CloudTabletMgr(); + + // If the tablet is in cache, return this tablet directly; otherwise will get tablet meta first, + // sync rowsets after, and download segment data in background if `warmup_data` is true. + Result<std::shared_ptr<CloudTablet>> get_tablet(int64_t tablet_id, bool warmup_data = false); + + void erase_tablet(int64_t tablet_id); + + void vacuum_stale_rowsets(); + + // Return weak ptr of all cached tablets. + // We return weak ptr to avoid extend lifetime of tablets that are no longer cached. + std::vector<std::weak_ptr<CloudTablet>> get_weak_tablets(); + + void sync_tablets(); + + /** + * Gets top N tablets that are considered to be compacted first + * + * @param n max number of tablets to get, all of them are comapction enabled + * @param filter_out a filter takes a tablet and return bool to check + * whether skipping the tablet, true for skip + * @param tablets output param + * @param max_score output param, max score of existed tablets + * @return status of this call + */ + Status get_topn_tablets_to_compact(int n, CompactionType compaction_type, + const std::function<bool(CloudTablet*)>& filter_out, + std::vector<std::shared_ptr<CloudTablet>>* tablets, Review Comment: warning: 'CloudTablet' does not refer to a value [clang-diagnostic-error] ```cpp std::vector<std::shared_ptr<CloudTablet>>* tablets, ^ ``` <details> <summary>Additional context</summary> **be/src/cloud/cloud_tablet_mgr.h:21:** declared here ```cpp class CloudTablet; ^ ``` </details> ########## be/src/cloud/cloud_tablet_mgr.h: ########## @@ -0,0 +1,68 @@ +// 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. + +#pragma once + +namespace doris { + +class CloudTablet; +class CloudStorageEngine; +class LRUCachePolicy; + +class CloudTabletMgr { +public: + CloudTabletMgr(CloudStorageEngine& engine); + ~CloudTabletMgr(); + + // If the tablet is in cache, return this tablet directly; otherwise will get tablet meta first, + // sync rowsets after, and download segment data in background if `warmup_data` is true. + Result<std::shared_ptr<CloudTablet>> get_tablet(int64_t tablet_id, bool warmup_data = false); + + void erase_tablet(int64_t tablet_id); + + void vacuum_stale_rowsets(); + + // Return weak ptr of all cached tablets. + // We return weak ptr to avoid extend lifetime of tablets that are no longer cached. + std::vector<std::weak_ptr<CloudTablet>> get_weak_tablets(); + + void sync_tablets(); + + /** + * Gets top N tablets that are considered to be compacted first + * + * @param n max number of tablets to get, all of them are comapction enabled + * @param filter_out a filter takes a tablet and return bool to check + * whether skipping the tablet, true for skip + * @param tablets output param + * @param max_score output param, max score of existed tablets + * @return status of this call + */ + Status get_topn_tablets_to_compact(int n, CompactionType compaction_type, + const std::function<bool(CloudTablet*)>& filter_out, + std::vector<std::shared_ptr<CloudTablet>>* tablets, + int64_t* max_score); + +private: + CloudStorageEngine& _engine; + + class TabletMap; + std::unique_ptr<TabletMap> _tablet_map; + std::unique_ptr<LRUCachePolicy> _cache; Review Comment: warning: use of undeclared identifier 'std' [clang-diagnostic-error] ```cpp std::unique_ptr<LRUCachePolicy> _cache; ^ ``` -- 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: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org