Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 3.9k
[improve](mow) merge and remove old version of delete bitmap when cumulative compaction is done #42479
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
[improve](mow) merge and remove old version of delete bitmap when cumulative compaction is done #42479
Changes from all commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,121 @@ | ||
| // 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 "delete_bitmap_action.h" | ||
| #include <rapidjson/document.h> | ||
| #include <rapidjson/encodings.h> | ||
| #include <rapidjson/prettywriter.h> | ||
| #include <rapidjson/rapidjson.h> | ||
| #include <rapidjson/stringbuffer.h> | ||
| #include <chrono> // IWYU pragma: keep | ||
| #include <exception> | ||
| #include <future> | ||
| #include <memory> | ||
| #include <mutex> | ||
| #include <sstream> | ||
| #include <string> | ||
| #include <thread> | ||
| #include <utility> | ||
| #include "common/logging.h" | ||
| #include "common/status.h" | ||
| #include "gutil/strings/substitute.h" | ||
| #include "http/http_channel.h" | ||
| #include "http/http_headers.h" | ||
| #include "http/http_request.h" | ||
| #include "http/http_status.h" | ||
| #include "olap/olap_define.h" | ||
| #include "olap/storage_engine.h" | ||
| #include "olap/tablet_manager.h" | ||
| #include "util/doris_metrics.h" | ||
| #include "util/stopwatch.hpp" | ||
| namespace doris { | ||
| using namespace ErrorCode; | ||
| namespace { | ||
| constexpr std::string_view HEADER_JSON = "application/json"; | ||
| } // namespace | ||
| DeleteBitmapAction::DeleteBitmapAction(DeleteBitmapActionType ctype, ExecEnv* exec_env, | ||
| TPrivilegeHier::type hier, TPrivilegeType::type ptype) | ||
| : HttpHandlerWithAuth(exec_env, hier, ptype), _delete_bitmap_action_type(ctype) {} | ||
| static Status _check_param(HttpRequest* req, uint64_t* tablet_id) { | ||
| const auto& req_tablet_id = req->param(TABLET_ID_KEY); | ||
| if (req_tablet_id.empty()) { | ||
| return Status::InternalError("tablet id is empty!"); | ||
| } | ||
| try { | ||
| *tablet_id = std::stoull(req_tablet_id); | ||
| } catch (const std::exception& e) { | ||
| return Status::InternalError("convert tablet_id failed, {}", e.what()); | ||
| } | ||
| return Status::OK(); | ||
| } | ||
| Status DeleteBitmapAction::_handle_show_delete_bitmap_count(HttpRequest* req, | ||
| std::string* json_result) { | ||
| uint64_t tablet_id = 0; | ||
| // check & retrieve tablet_id from req if it contains | ||
| RETURN_NOT_OK_STATUS_WITH_WARN(_check_param(req, &tablet_id), "check param failed"); | ||
| if (tablet_id == 0) { | ||
| return Status::InternalError("check param failed: missing tablet_id"); | ||
| } | ||
| TabletSharedPtr tablet = StorageEngine::instance()->tablet_manager()->get_tablet(tablet_id); | ||
| if (tablet == nullptr) { | ||
| return Status::NotFound("Tablet not found. tablet_id={}", tablet_id); | ||
| } | ||
| auto count = tablet->tablet_meta()->delete_bitmap().get_delete_bitmap_count(); | ||
| auto cardinality = tablet->tablet_meta()->delete_bitmap().cardinality(); | ||
| auto size = tablet->tablet_meta()->delete_bitmap().get_size(); | ||
| rapidjson::Document root; | ||
| root.SetObject(); | ||
| root.AddMember("delete_bitmap_count", count, root.GetAllocator()); | ||
| root.AddMember("cardinality", cardinality, root.GetAllocator()); | ||
| root.AddMember("size", size, root.GetAllocator()); | ||
| // to json string | ||
| rapidjson::StringBuffer strbuf; | ||
| rapidjson::PrettyWriter<rapidjson::StringBuffer> writer(strbuf); | ||
| root.Accept(writer); | ||
| *json_result = std::string(strbuf.GetString()); | ||
| return Status::OK(); | ||
| } | ||
| void DeleteBitmapAction::handle(HttpRequest* req) { | ||
| req->add_output_header(HttpHeaders::CONTENT_TYPE, HEADER_JSON.data()); | ||
| if (_delete_bitmap_action_type == DeleteBitmapActionType::COUNT_INFO) { | ||
| std::string json_result; | ||
| Status st = _handle_show_delete_bitmap_count(req, &json_result); | ||
| if (!st.ok()) { | ||
| HttpChannel::send_reply(req, HttpStatus::OK, st.to_json()); | ||
| } else { | ||
| HttpChannel::send_reply(req, HttpStatus::OK, json_result); | ||
| } | ||
| } | ||
| } | ||
| } // namespace doris |
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
| @@ -0,0 +1,51 @@ | ||||
| // 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 | ||||
| #include <stdint.h> | ||||
| #include <string> | ||||
| #include "common/status.h" | ||||
| #include "http/http_handler_with_auth.h" | ||||
| #include "olap/tablet.h" | ||||
| namespace doris { | ||||
| class HttpRequest; | ||||
| class ExecEnv; | ||||
| enum class DeleteBitmapActionType { COUNT_INFO = 1 }; | ||||
| /// This action is used for viewing the delete bitmap status | ||||
| class DeleteBitmapAction : public HttpHandlerWithAuth { | ||||
| public: | ||||
| DeleteBitmapAction(DeleteBitmapActionType ctype, ExecEnv* exec_env, TPrivilegeHier::type hier, | ||||
| TPrivilegeType::type ptype); | ||||
| ~DeleteBitmapAction() override = default; | ||||
| void handle(HttpRequest* req) override; | ||||
| private: | ||||
| Status _handle_show_delete_bitmap_count(HttpRequest* req, std::string* json_result); | ||||
| private: | ||||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: redundant access specifier has the same accessibility as the previous access specifier [readability-redundant-access-specifiers]
Suggested change
Additional contextbe/src/http/action/delete_bitmap_action.h:44: previously declared here private:
^ | ||||
| DeleteBitmapActionType _delete_bitmap_action_type; | ||||
| }; | ||||
| } // namespace doris | ||||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: inclusion of deprecated C++ header 'stdint.h'; consider using 'cstdint' instead [modernize-deprecated-headers]