15
15
// specific language governing permissions and limitations
16
16
// under the License.
17
17
18
- #include " cloud_delete_bitmap_action .h"
18
+ #include " delete_bitmap_action .h"
19
19
20
20
#include < rapidjson/document.h>
21
21
#include < rapidjson/encodings.h>
33
33
#include < thread>
34
34
#include < utility>
35
35
36
+ #include " cloud/cloud_storage_engine.h"
36
37
#include " cloud/cloud_tablet.h"
37
38
#include " cloud/cloud_tablet_mgr.h"
39
+ #include " cloud/config.h"
38
40
#include " common/logging.h"
39
41
#include " common/status.h"
40
42
#include " gutil/strings/substitute.h"
43
45
#include " http/http_request.h"
44
46
#include " http/http_status.h"
45
47
#include " olap/olap_define.h"
46
- #include " olap/storage_engine.h"
47
48
#include " olap/tablet_manager.h"
48
49
#include " util/doris_metrics.h"
49
50
#include " util/stopwatch.hpp"
@@ -57,10 +58,9 @@ constexpr std::string_view HEADER_JSON = "application/json";
57
58
58
59
} // namespace
59
60
60
- CloudDeleteBitmapAction::CloudDeleteBitmapAction (DeleteBitmapActionType ctype, ExecEnv* exec_env,
61
- CloudStorageEngine& engine,
62
- TPrivilegeHier::type hier,
63
- TPrivilegeType::type ptype)
61
+ DeleteBitmapAction::DeleteBitmapAction (DeleteBitmapActionType ctype, ExecEnv* exec_env,
62
+ BaseStorageEngine& engine, TPrivilegeHier::type hier,
63
+ TPrivilegeType::type ptype)
64
64
: HttpHandlerWithAuth(exec_env, hier, ptype),
65
65
_engine (engine),
66
66
_delete_bitmap_action_type(ctype) {}
@@ -78,20 +78,24 @@ static Status _check_param(HttpRequest* req, uint64_t* tablet_id) {
78
78
return Status::OK ();
79
79
}
80
80
81
- Status CloudDeleteBitmapAction ::_handle_show_delete_bitmap_count (HttpRequest* req,
82
- std::string* json_result) {
81
+ Status DeleteBitmapAction ::_handle_show_delete_bitmap_count (HttpRequest* req,
82
+ std::string* json_result) {
83
83
uint64_t tablet_id = 0 ;
84
84
// check & retrieve tablet_id from req if it contains
85
85
RETURN_NOT_OK_STATUS_WITH_WARN (_check_param (req, &tablet_id), " check param failed" );
86
86
if (tablet_id == 0 ) {
87
87
return Status::InternalError (" check param failed: missing tablet_id" );
88
88
}
89
89
90
- CloudTabletSPtr tablet = DORIS_TRY (_engine.tablet_mgr ().get_tablet (tablet_id));
90
+ BaseTabletSPtr tablet = nullptr ;
91
+ if (config::is_cloud_mode ()) {
92
+ tablet = DORIS_TRY (_engine.to_cloud ().tablet_mgr ().get_tablet (tablet_id));
93
+ } else {
94
+ tablet = _engine.to_local ().tablet_manager ()->get_tablet (tablet_id);
95
+ }
91
96
if (tablet == nullptr ) {
92
97
return Status::NotFound (" Tablet not found. tablet_id={}" , tablet_id);
93
98
}
94
-
95
99
auto count = tablet->tablet_meta ()->delete_bitmap ().get_delete_bitmap_count ();
96
100
auto cardinality = tablet->tablet_meta ()->delete_bitmap ().cardinality ();
97
101
auto size = tablet->tablet_meta ()->delete_bitmap ().get_size ();
@@ -111,7 +115,7 @@ Status CloudDeleteBitmapAction::_handle_show_delete_bitmap_count(HttpRequest* re
111
115
return Status::OK ();
112
116
}
113
117
114
- void CloudDeleteBitmapAction ::handle (HttpRequest* req) {
118
+ void DeleteBitmapAction ::handle (HttpRequest* req) {
115
119
req->add_output_header (HttpHeaders::CONTENT_TYPE, HEADER_JSON.data ());
116
120
if (_delete_bitmap_action_type == DeleteBitmapActionType::COUNT_INFO) {
117
121
std::string json_result;
0 commit comments